-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bug: sam local start-api - JSONDecodeError on API call with data #5799
Comments
thanks @irby for raising this issue. I will try to reproduce this issue. |
I encountered a the same Just noticed that 1.96 was released today, tested with that and have the same error as 1.95. |
@sbchisholm, can you share your template with us, and also the function code? |
I can't share the function code unfortunately but I will say that it's C++. sam cmd:
template:
|
can you run this command with |
|
@sbchisholm @irby Could you please let me know what your Lambda Code returns? |
Yes it's just a string that says done or success or something simple like that. We're not returning an actual json object. |
I tried to reproduce and couldn't. I'm pretty sure that, in your case, the response from Lambda RIE was not a valid string that In my attempts to reproduce the issue, I tried returning a string and returning nothing. And both responses got deserialized successfully. I think we can handle the |
|
I fixed this increasing the |
I had the same problem, also with axios, and this worked for me too, changed it from 128 to 256 and my axios.post works now. Thanks for figuring this out. |
Patch is released in v1.98.0. Closing |
Description:
I've noticed similar JSONDecodeError bugs mentioned in #4656 and #5067, but this one is specific to API calls made within my Lambda functions when I run locally. I'm running the latest SAM CLI version.
Steps to reproduce:
Have a request with data that is either sent to
axios
orfetch
. For example:This call will
If I remove the
data
object from the axios call, I no longer hit this exception. For example:I do not hit the JSONDecodeError when I deploy my Lambda function to AWS, so I have a feeling this error is due to something under-the-hood in the SAM environment running my Lambda.
I've tried using
fetch
instead ofaxios
to see if this was somethingaxios
related, but I saw similar results.Observed result:
A
json.decoder.JSONDecodeError
is thrown when calling an API call with dataExpected result:
This error should not be thrown
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
The text was updated successfully, but these errors were encountered: