When using debug configurations for an AWS SAM application using API invocation you are unable to pass a payload containing anything other than JSON data however this works just fine if you start up the API using SAM CLI and then execute a curl request to the API endpoint. It also works in live environments.
To Reproduce
Steps to reproduce the behavior:
Create the sample HelloWorld SAM application using the VSCode Toolkit
Add an API debug configuration like this one I've included below.
Try setting the path to a file that contains XML rather than JSON data.
See error saying it's an invalid JSON file.
Expected behavior
I should be able to pass a payload containing any type of data I wish, just like you can with a normal API gateway / lambda combination.
Thanks for the report! We seem to assume a JSON payload in many different places beyond the launch config, so I'm tracking this issue apart of a larger story.
Describe the bug
When using debug configurations for an AWS SAM application using API invocation you are unable to pass a payload containing anything other than JSON data however this works just fine if you start up the API using SAM CLI and then execute a curl request to the API endpoint. It also works in live environments.
To Reproduce Steps to reproduce the behavior:
Expected behavior
I should be able to pass a payload containing any type of data I wish, just like you can with a normal API gateway / lambda combination.
Debug configuration showing what I tried:
Contents of test.xml:
Here's the steps showing I can accomplish what I"m trying to accomplish outside of the debug configuration but not with it:
sam build --use-container
sam local start-api
curl http://localhost:3000/hello -d '<xml>greeting</xml>'