We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It appears serverless-offline is parsing a stringified JSON response of a lambda integration, hence giving a different result online vs. offline.
Considering the following function:
module.exports.hello = async (event) => { return JSON.stringify({ toto: "tutu" }); };
And the following serverless.yml:
service: testjson plugins: - serverless-offline provider: name: aws runtime: nodejs10.x stage: dev region: eu-west-3 functions: hello: handler: handler.hello events: - http: path: test method: GET integration: lambda cors: true
When running locally, I get:
$ curl http://localhost:3000/test {"toto":"tutu"}
When deployed, I get:
$ curl https://whatever.execute-api.eu-west-3.amazonaws.com/dev/test "{\"toto\":\"tutu\"}"
However, if I change the function to:
module.exports.hello = async (event) => { return { toto: "tutu" }; };
I get {"toto":"tutu"} everywhere (as expected).
{"toto":"tutu"}
The text was updated successfully, but these errors were encountered:
Hello, I will look into this issue
Sorry, something went wrong.
Fix lambda integration string responses, fixes #834, #702
7cd3022
No branches or pull requests
It appears serverless-offline is parsing a stringified JSON response of a lambda integration, hence giving a different result online vs. offline.
Considering the following function:
And the following serverless.yml:
When running locally, I get:
When deployed, I get:
$ curl https://whatever.execute-api.eu-west-3.amazonaws.com/dev/test "{\"toto\":\"tutu\"}"
However, if I change the function to:
I get
{"toto":"tutu"}
everywhere (as expected).The text was updated successfully, but these errors were encountered: