Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template Spec errors when changing version or requesting other module #14660

Closed
cedricbraekevelt opened this issue Jul 25, 2024 · 6 comments
Closed
Assignees
Milestone

Comments

@cedricbraekevelt
Copy link

Bicep version
Bicep CLI version 0.29.47 (132ade5) (has been valid since I've started)

Describe the bug
When using modules from Template Spec, I get the following error at random times a lot:
image

The referenced ARM template has errors. Please see https://aka.ms/arm-template for information on how to diagnose and fix the template.bicep(BCP188)

I get this on all my modules in Template Spec, and at random times mostly when changing module version or when changing the module name. However, after a restart of vscode it works fine and the error is gone!
image

To Reproduce
Upload modules to template spec and try different versions, change references to different modules. It will show errors, however after a restart of vscode it will be fixed and you can deploy!

Additional context
I didn't seem to notice this error when we were using ACR however, we need Template Spec because our templates have become way to big and Template Spec seems to use templatelink where ACR embeds the content of the referred template. Do note that my modules use lots of user defined functions and types!

@cedricbraekevelt
Copy link
Author

@stephaniezyen will this be looked at before 0.30?
Or is the adoption of TS instead of ACR too low to prioritize this?

@shenglol
Copy link
Contributor

Hi @cedricbraekevelt apologies for the delay. I'm prioritizing this now.

@shenglol shenglol moved this from Todo to In Progress in Bicep Aug 21, 2024
@shenglol
Copy link
Contributor

While I couldn't reproduce the issue by updating the template spec version in the module reference string, I consistently encountered the same error when using the Go to definition command for the template spec module. This seems to be an unintended regression from a previous effort to improve the user experience when peeking into the source files of external registry modules.

shenglol added a commit that referenced this issue Aug 22, 2024
The "Go to Definition" feature for template specs in VS Code is
currently broken. When used, it opens the template spec JSON file in an
editable state, though it should be read-only. This action then triggers
the `documentDidOpen` event for the JSON file, which leads to a
compilation update for the template spec module. As a result, the Bicep
compiler mistakenly interprets the template spec JSON file as an ARM
template, causing an `The reference ARM template has errors` message.
This PR aims to fix that issue.

The problem was initially identified during the investigation of issue
#14660. However, this PR might not fully resolve the issue, as according
to the customer, the `The reference ARM template has errors` message can
still appear randomly, even when "Go to Definition" is not used.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/14871)
@cedricbraekevelt
Copy link
Author

Hi @shenglol,

Didn't want to stress you guys, was just curious where this issue was located in the prio list ;)
Thanks for investigating, I'll be sure to test this out. PS: I'm working with AZ Pwsh credential precedence towards TS. (As I'm mainly using AZ Pwsh, not AZ CLI).

@cedricbraekevelt
Copy link
Author

@shenglol Is there any other way I can generate logs from loading these modules?

@shenglol
Copy link
Contributor

shenglol commented Aug 28, 2024

@cedricbraekevelt I've submitted a PR to address the issue. We're planning to publish a release soon. In the meantime, you can try the nightly build to see if the fix resolves the problem.

@stephaniezyen stephaniezyen moved this from In Progress to Done in Bicep Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants