Skip to content

Can't launch valid JSON CFN except through Designer

0

I'm not able to launch valid CloudFormation JSON templates from either direct upload or when they're placed in an S3 bucket -- when I ask Designer what the problem is via "View In Designer", I see the most baffling syntax highlighting problem ( https://imgur.com/a/Q3aVtPq ). However, for these same templates, if I upload them directly into Designer, Designer accepts them as valid without issue, and I can proceed with stack creation.

Please see https://s3.amazonaws.com/openemr-cfn-useast1/OpenEMR-Express-Plus.json for an example of a template that CloudFormation cannot parse (but Designer can load), or see https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=OpenEMR&templateURL=https://s3.amazonaws.com/openemr-cfn-useast1/OpenEMR-Express-Plus.json for one-stop review of the issue.

Thanks!

asked 4 years ago348 views
2 Answers
0

Seems you figured it out. It works now when I tested via validate-template as well as direct upload. :)

AWS
answered 4 years ago
  • Hello, Ev.

    I appreciate you checking! Unfortunately, I didn't change anything and after testing just now I'm still seeing the same behavior -- on two otherwise-unconnected AWS accounts, no less. As soon as I hit the orange "Next" button I slap right back to the same screen with a red banner announcing "Template contains invalid characters", and selecting "View in Designer" gives the same deranged parse I quoted in the screenshot.

    Is there anything I can provide to help narrow this issue down?

  • Just to let you know, I had another user test and verify this issue as well -- that's two people, four accounts, that have uniformly shown this behavior. Is there a CR/LF thing that Designer doesn't get tripped up by but straight import does, maybe?

0

Okay, I found it. My stack files were being built by the Python library troposphere and written to disk via pipe, and SOMEWHERE in that chain of great decisions the files were being written in UTF-16 encoding, which explains all of this behavior -- CloudFormation is unable to parse the file, and Designer correctly shows the bloat of incomprehensible two-byte characters (which is why everything was spaced out funny in the parse screenshot) but when the file is directly uploaded into Designer, Designer is smart enough to transcode the file back into UTF-8 and export something CloudFormation could accept.

To me this is a clear CloudFormation bug -- if it doesn't like the encoding it should be detecting and rejecting it on those terms, because the only reason I figured this out is because I spotted VSCode mention UTF16 when I was uselessly toggling the CRLF encoding.

Thanks!

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Relevant content