Closed eduardoflorence closed 1 year ago
Hi Jeremy, I also have the same issue. When my lambda function is not in a VPC then the lambda-warmer works perfectly. However when it is in a VPC it always times out. I've tried putting my Lambda in both a public and private subnet with internet gateway/nat gateways with no success. I'm very new to AWS so any assistance you can give will be greatly appreciated.
Thanks for the report. I am looking into this.
This is most likely a issue with your VPC configuration, rather then this module. When lambda.invoke()
is called from the aws-sdk
library, it makes an HTTP request, using the syntax shown here: https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html
Try making any outgoing HTTP request with your lambda function. If it fails, then you will not be able to call Invoke.
The solution is to use two subnets, one public and one private. Create an Internet Gateway to connect the VPC to the internet. Create a NAT Gateway inside the public subnet. Create a route in the public subnet to the Internet Gateway, and a route in the private subnet to the NAT Gateway. More details can be found here: https://stackoverflow.com/a/39206646/1431777
I am currently using lambdas in a VPC, and can confirm that Concurrency > 1 works, given this architecture.
I encountered this issue as well and it was because the VPC didn't have outbound access. What got me was that the NAT instance I had created was in a private subnet. Making a new one in a public subnet solved the issue.
Having same issue when lambda is inside VPC -- one workaround is adding multiple same targets to your lambda from Cloudwatch event rule and make concurrency always as 1.
Concurrency calls will be made at same time, you'll find trace data from X-Ray. And in my case, the lambda in VPC will be destroyed around 12 mins, not 15 mins.
I'll be closing this issue, @jmhummel's answer seems to resolve this.
If anyone wants this to be re-opened, let me know. Also, if anyone wants to open a PR that explains this in the README it'll be very welcome 🙏
When the concurrency parameter is greater than one, if the lambda function is not in a VPC, everything works normally, but if it is in a VPC the promise is never resolved. If I put concurrency equal to one, it works normally in VPC. Please, is there any way to resolve this?