SAM local commands misbehave for CDK Templates synthesized in PowerShell
See original GitHub issueDescription
Operating on a Windows machine and using a Powershell terminal, when a user synthesizes a template from an AWS-CDK application, the output template does not behave as expected when invoking sam local commands.
Steps to reproduce
- Open a Powershell terminal
- Set the default out file encoding to utf8. See #1628 for details.
$PSDefaultParameterValues[‘Out-File:Encoding’] = ‘utf8’
- Synthesize a template from a CDK application.
cdk synth > template.yml
- Invoke a sam local command
sam local invoke MyFunction3BAA72D1 --debug
Observed result
The sam local commands fail with the error message
Error: [InvalidTemplateException(“‘Resources’ section is required”)] ‘Resources’ section is required
Expected result
I expected the lambda function to be executed in a container.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Windows 10 Enterprise
sam --version
: 0.41.0- node: 12.14.1
- python 3.6.5
Interestingly when I synthesized the template from Git Bash instead of PowerShell, the sam local commands appeared to work as expected.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
SAM local commands misbehave for CDK Templates ...
Operating on a Windows machine and using a Powershell terminal, when a user synthesizes a template from an AWS-CDK application, the output ...
Read more >Locally testing AWS CDK applications
Use the sam local command to locally test AWS CDK applications.
Read more >devops | Noise | Page 2
A local installation of and experience using the AWS CDK. Create a baseline AWS CDK application. In this section you will create and...
Read more >upF
Seducing drake palma pop fiction, Straw flag blank template, El perro opositor. ... Liverpool vs shamrock rovers squad, Boilermakers local 28, ...
Read more >vocab
... 245 amazon.com 246 area 247 shop 248 pool 249 card 250 white 251 time 252 i 253 system 254 john 255 maps...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Possible Causes: Error: [InvalidTemplateException(“‘Resources’ section is required”)] ‘Resources’ section is required
Error: Failed to parse template: unacceptable character #x0000: special characters are not allowed in “<unicode string>”, position 3
Any update on this? I get the following error when synthesizing a CDK template to be consumed by AWS SAM with Powershell via VSCode (on Win10)
Error: Failed to parse template: unacceptable character #x0000: special characters are not allowed in "<unicode string>", position 3
Works fine running the same commands in command prompt
SAM version : 0.49.0 CDK version: 1.51.0