gkrizek / bash-lambda-layer

Run Bash scripts in AWS Lambda via Layers
MIT License
424 stars 91 forks source link

Unable to use Lambda proxy integration in API Gateway #68

Open MCoLoL opened 4 years ago

MCoLoL commented 4 years ago

Hello, i'm trying to do an integration with API Gateway and Lambda with the "Proxy integration". I configured the bash script with the response as described in the documentation.

echo "{\"success\": true}" >&2 or this for apigw "{\"isBase64Encoded\": false,\"statusCode\": 200,\"headers\": { \"Access-Control-Allow-Origin\": \"*\"},\"body\": \"OK\"}"

but seems that the script is not exiting succesfully and then apigw will response with a 500. In the log of API GW seems that there is a RuntimeErrorException and the script exit with 6.

Those are the logs:

(a4be7bdd-e53a-409a-b804-28f9129cde0b) Endpoint response body before transformations: { "errorMessage": "Exited with code 6", "errorType": "RuntimeErrorException", "stackTrace": "" } (a4be7bdd-e53a-409a-b804-28f9129cde0b) Lambda execution failed with status 200 due to customer function error: Exited with code 6. Lambda request id: 9f7c4d24-afee-4ef9-ae14-14e8afcbb712 (a4be7bdd-e53a-409a-b804-28f9129cde0b) Method completed with status: 502

Any clue? It would be great if the exit code will be 0 and if we can have the possibility to set the response needed by apigw. Thanks