You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to call the lambda function using a request to the start-api, the function is executing, but when it tries to return I get this error:
Function returned an invalid response (must include one of: body, headers or statusCode in the response object). Response received: b'\n{ "statusCode": 200, "jsonvalues": "values" }'
This is the same issue mentioned by @makskant a couple days ago on #314
It was recommended by @sanathkr to cut a new issue to discuss this. As Sanath noted, the issue is likely that \n is getting returned with the json. However, the handler looks something like this:
def my_handler(event, context):
# function code
return { "statusCode": ###, "jsonvalues": "values" } # return back JSON
I do not see any newline character before the object, so I am wondering if I am doing something wrong here. What could be causing this issue?
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Linux OS, function written using Python 3.6
Output of sam --version: 0.4.0
The text was updated successfully, but these errors were encountered:
To answer the "I am wondering if I am doing something wrong here. What could be causing this issue?":
The new line character is added due to the response of the Lambda Docker is given as the last line in the stdout from the container. Since we parse the stdout to get the return, we need to strip out all newlines (and other characters). This is where the '\n' character is coming from.
@josephthweatt I am working on prioritizing it in an upcoming sprint but can't say when we will have a fix or a release that addresses this. You can follow the issue I linked to stay updated with it.
Description:
I am trying to call the lambda function using a request to the start-api, the function is executing, but when it tries to return I get this error:
This is the same issue mentioned by @makskant a couple days ago on #314
It was recommended by @sanathkr to cut a new issue to discuss this. As Sanath noted, the issue is likely that
\n
is getting returned with the json. However, the handler looks something like this:I do not see any newline character before the object, so I am wondering if I am doing something wrong here. What could be causing this issue?
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Linux OS, function written using Python 3.6
Output of
sam --version
:0.4.0
The text was updated successfully, but these errors were encountered: