For past few months I have a strange problem. Sometimes (maybe once in 10 days) all of my Lambda functions show 500 or 502 errors. This lasts only for a few minutes, so I can’t properly diagnose the problem. When this error occurs I check cloudwatch logs, but it seems that API calls don’t even reach the code. During this errors, software works on a local machine and database seems to be fine. Runtime for all of the code is Node.js10.x.
Does anybody have this kind of problem?
What can be the possible solution?
Anything in the logs?
Does the invocation actually trigger an error as well?
No logs in cloudwatch during the problem. I tried http requests with postman (most of the functions are http events), but it returns the same error.
Do you have a copy of the response packet? It would be interesting to see if there are any errors there. Also how are you calling these Lambda functions, what’s the workflow?
Most of the functions are http events. Basically they are APIs for various services and are called from front-end.
the only response I have saved is a postman response and it has only a message: ‘Internal server error’
Make sure it’s not a memory leak in your code. I’ve seen this type of behavior due to that in the past.
I would guess the 500 isn’t actually from your lambda but from the api gw when it doesn’t get a response.
Next step is API Gateway logs.
You should have much more than that in the header of the response. What does it say in full? Feel free to abstract IP and/or detailed pathing.
Is lambda inside a VPC?
What DNS are you using?
Enable x-ray tracing
All of your lambda erroring out is quite strange. Lambdas can error out sometime as it is a complex distributed system. But all together is very very strange!
Don’t be an ass. Clearly lambda has an SLA, he just linked to it. Your assertion that Lambda ‘has no SLA guarantee’ is categorically wrong. The SLA also says nothing about response time.
What you are saying is also true though, but that is a totally different thing than an SLA. An SLA is a business agreement and the way users should interpret it is ‘if my lambda availability falls below the SLA, then AWS will give me a refund’. This is all that it means. It does not in any way mean that Lambda will actually provide these availability numbers. Although it is an incentive for Lambda to provide this uptime so they can actually continue to operate as a business.
Lambda isn’t bullet proof. It will have issues sometimes. ‘Everything fails, all the time’ is a quote from Amazon’s CTO and Lambda is no exception.
If the availability you’re getting from lambda isn’t good enough for you, then you should either talk to your rep and ask about solutions or maybe don’t use lambda.
If your availability is falling below the stated SLA then contact support, they will give you service credit: https://aws.amazon.com/lambda/sla/
My professional opinion is: From this perspective: use lambda, accept that sometimes you will have issues outside your control, and know that countless smart people at Amazon spend all their time trying to make this situation better for you without your input. They will do a better job at it then you will.