Launching lambda: "Too many requests" error

0

I have a lambda that builds and launches new lambda functions based on a configuration file. The child lambda configurations are stored locally, and when updated are sent to an S3 bucket, where a trigger launches the Builder lambda to read the configuration file and create or update the corresponding child lambda.

I made a global change to the configuration files and sent them all to S3, and it looks like ten instances of the Builder started up and generated updated versions of their child lambdas. However the remaining ones died with a "Too Many Requests" error while waiting for an UpdateFunctionCodeCommand() to complete. Now any requests I make get the same error.

Does this number 10 ring a bell? Am I hitting some concurrency limit?

I can't figure it out, maybe the builders are deadlocked or something.

This is what my lambda dashboard is showing:

My lambda dashboard

dmb0058
asked 7 months ago371 views
3 Answers
0
Accepted Answer

OK, so (not for the first time) it was my own idiocy! I thought I'd post this rather than kill the question, as it just might help someone down the line :)

I had a function called a little later that checked to see if an API Gateway integration existed for the lambda. The basic shape of the function was

get the first 50 integrations using GetIntegrationsCommand()
save the NextToken marker if there is one
iterate through the list to see if there's a match
       if there is, return it


while there are more integrations
      get the next 50 using GetIntegrationsCommand() <<<<<<<<
      save the Next Token if there is one
      iterate through the list to see if there's a match       
                if there is, return it

return null

The problem was I forgot to include the NextToken in the call at "<<<<<", so the call was just spinning out, getting the same results over and over, and very helpfully, generating a "Too Many Requests" exception. The results looked unpredictable, because if a match was found in the first 50, everything worked, otherwise the exception was thrown.

Now I can build and launch tens of simultaneous (hopefully hundreds!) lambdas.

dmb0058
answered 7 months ago
0

Hello.

Would it improve if I increase the number of concurrent Lambda functions?
https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html#configuration-concurrency-reserved

profile picture
EXPERT
answered 7 months ago
0

I don't think so ... I don't see why I'd need reserved instances as I'm not concerned about the startup time, and the Function concurrency configuration is "Use unreserved account concurrency" with "Unreserved account concurrency 1000" so I don't think I hit that limit.

My Builder instance(s?) seem to be stuck now, as they will build new lambdas but can't deploy them - when they try to update the function code they get the "Too many errors" exception. I don't know if this will time out at some point, but even if they do I can't have a limit of ten concurrent invocations - I need thousands :)

It's almost as if I've hit some account-wide limit?

dmb0058
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions