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

Fails to create a parameter file for arm template when encoded with UTF-8 BOM #721

Closed
kernst123 opened this issue May 20, 2020 · 13 comments · Fixed by #768
Closed

Fails to create a parameter file for arm template when encoded with UTF-8 BOM #721

kernst123 opened this issue May 20, 2020 · 13 comments · Fixed by #768

Comments

@kernst123
Copy link

Does this occur consistently? Yes
Repro steps:

  1. from vs code create a new arm template (use snippet arm! )
  2. from vs code select/create parameter file...
    I receive the error below

Action: azurerm-vscode-tools.selectParameterFile
Error type: Error
Error Message: "e:\temp\armtemp\mytemplate.json" does not appear to be an Azure Resource Manager deployment template file.

Version: 0.10.0
OS: win32
OS Release: 10.0.17763
Product: Visual Studio Code
Product Version: 1.45.1
Language: en

Call Stack
Object.<anonymous> extension.bundle.js:1:596601
fulfilled extension.bundle.js:1:593686
@StephenWeatherford
Copy link
Contributor

@kernst123 Thanks for entering!

Was the file saved before doing step 2? If not, it's probably a duplicate of #666.

@kernst123
Copy link
Author

kernst123 commented May 20, 2020 via email

@StephenWeatherford
Copy link
Contributor

@neilpeterson This looks vaguely familiar but I can't find any dups. Have you seen this behavior? Thx.

@neilpeterson
Copy link
Contributor

@StephenWeatherford nope this appears to be unique as compared to similar open items.

I was however able to reproduce the error / call stack by trying to create a parameters file from an invalid ARM template (removed the opening bracket).

@kernst123 can you share the ARM template that you using when attempting to create the parameter file?

Thanks

@kernst123
Copy link
Author

kernst123 commented May 21, 2020

Here is an example of the arm template it failed for.
I blanked out the tenant-id and the objectID so you will nee to put something relevant in for that.
My original version I did infact run and it created the key vault just to confirm that it is valid.
I hope this helps.

@kernst123
Copy link
Author

Hmmm I thought I posted a zip file. I don't see it above. I will try again.
test.json.zip

@neilpeterson
Copy link
Contributor

Thanks @kernst123, I noticed that both tenant and object id did have values so removed the file from the issue.

I am looking at it now, but unfortunately cannot reproduce the issue. I am able to create the parameter file without issue using the provided tempalte.

@kernst123
Copy link
Author

Hmm it's a tricky one.
Here is a screenshot showing the error.
image

Is there any logging I could enable on my end?
Or any version info that might be relevant that I could show you?

@StephenWeatherford
Copy link
Contributor

I can repro with the attached, thanks (not sure why Neil can't). We're having trouble with the UTF-8 BOM (the one on disk, not the text buffer).

@StephenWeatherford StephenWeatherford changed the title Fails to create a parameter file for arm template Fails to create a parameter file for arm template when encoded with UTF-8 BOM May 21, 2020
@neilpeterson
Copy link
Contributor

Ahhh, works fine on my Mac but does repo in Windows.

@StephenWeatherford
Copy link
Contributor

Weird, I repro'd it with my Mac.

@kernst123
Copy link
Author

As soon as I changed the encoding from utf8 bom to utf8 it started working.
thanks.
I changed vscode's default to utf8 from the old value utf8 bom.

@StephenWeatherford
Copy link
Contributor

Fix released with 0.11.0

@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants