- Más nuevo
- Más votos
- Más comentarios
I recommend that you add log lines to your function and check in the logs where your function is stuck.
I found the error.
There was an issue with my VPC. 2 important things when you attach a VPC to your Lambda: You can't have a public subnet associated. Check if your VPC was created correctly.
Steps: Create a new VPC, using this yaml: https://github.com/awsdocs/aws-lambda-developer-guide/blob/main/templates/vpc-privatepublic.yaml
Or test your Lambda without VPC.
Both tests might work and fix your issue, as it fixed mine.
I hope this helps more people in this community.
Related links: https://repost.aws/knowledge-center/internet-access-lambda-function https://stackoverflow.com/questions/51373609/why-aws-lambda-functions-in-a-vpc-sometimes-timeout-and-sometimes-work-fine
Contenido relevante
- OFICIAL DE AWSActualizada hace un año
- OFICIAL DE AWSActualizada hace 2 años
Hey Uri, thanks for your answer. So I have logs in my function, and the weird thing is that it's like the connection is being dropped after some time executing or something. I will give an example: I have that sequence of logs:
2024-04-04T10:04:02.333Z checking for cache 2024-04-04T10:04:02.340Z the path already exists - In that case, I don't need to download again and then I get the file from EFS 2024-04-04T10:04:02.466Z You don't set any options 2024-04-04T10:04:02.466Z your data metadata is ... 2024-04-04T10:04:02.613Z init the process 2024-04-04T10:04:02.613Z option set to False 2024-04-04T10:04:02.613Z intermediate results 2024-04-04T10:04:02.619Z execution time: 0.2852690909994635 2024-04-04T10:09:02.485Z 2024-04-04T10:09:02.484Z b8660e79-58f6-4069-b0f1-98f4e4d3f509 Task timed out after 300.14 seconds What is expected here, is the response (it's already done, when we receive the execution time, the difference is 100ms after this message in a normal execution, until you receive your message). But sometimes, out of nowhere, I didn't receive ( it's random )
I checked my NAT gateway and yesterday my instance was incommunicable for 1 hour ( the active connections count and bytes out graphics go to Zero in that period )
I have this one period for the day when my instance remains noncommunicable for some reason. Besides that time of the day, it works well.