Search code examples
node.jsaws-lambdaserverlessserverless-framework

Internal server error with status code 502, with node 18.x


I am new in serverless deployments, I have written a script for github action workflow to do serverless deployment of a lambda function. My script is working perfectly fine with both Node 14.x and Node 18.x, But with Node 18.x, after the deployment when I tried to access the lambda function’s payload it gives me internal server error with status code 502, Can anyone please tell me what could be the possible reasons for the error in this scenario? I know I am not posting any code snippet or script here because of the code security reasons. but if anyone can provide me possible solutions, that would be really helpful. Thanks

I have tried making the changes in package.json file, but that doesn’t helped.


Solution

  • There are several possibilities when Lambda returns a 502 error. It could be due to the Lambda function's response being incorrectly formed or containing invalid content. The best way to troubleshoot this error is by utilizing CloudWatch. Additionally, if necessary, you can enable X-Ray for further debugging. If you using API Gateway to access the lambda function, you can turn on API Gateway logging and you'll see more information in CloudWatch. This related documentation hopefully can help you :