Search code examples
node.jsaws-lambdapublish-subscribegoogle-cloud-functions

How do you respect api limits when using cloud functions?


I see two options...

Either cloud function connects to some database that keeps track of last calls and number of calls.

Or...

Something that is invoking and is permanent, builds a queue and invoke appropriately.

I'm really not sure how pub/sub system that would work for 2nd option. As function could be invoked by anywhere, does that mean i'd have to keep track from all places in DB, which doesn't sound right, for every api call i'd have to create api manager that would store the meta data in db? sounds like overkill.


Solution

  • Retry throttled API calls, API Gateway will respond with a 429 Too Many Requests, you can use modules like requestretry or do it yourself : Error Retries and Exponential Backoff in AWS