scaleway / serverless-scaleway-functions

Plugin for Serverless Framework to allow users to deploy their serverless applications on Scaleway Functions
MIT License
78 stars 25 forks source link

Rate limit error when deploying a lot of functions with trigger #134

Open tdelmas opened 1 year ago

tdelmas commented 1 year ago

When deploying ~20 functions with ~10 triggers each, serverless deploy hits rate limits

Deploying triggers...
Environment: linux, node 16.18.1, framework 3.25.1, plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: AxiosError: Request failed with status code 429
    at manageError (/github/workspace/node_modules/serverless-scaleway-functions/shared/api/utils.js:20:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 3)
    at async Promise.all (index 1)

The code handling deployment:

https://github.com/scaleway/serverless-scaleway-functions/blob/master/deploy/lib/deployTriggers.js#L19-L23

could be improved in my opinion to avoid hitting rates limits:

thomas-tacquet commented 1 year ago

Thank you for analysis 👍

I'll try to improve the deploy trigger workflow, there is a complete delete/create of triggers each time because there are multiple sources of trigger CRUD (Scaleway Console, API, 3rd party tools etc...). The case an user wants to remove all of it's triggers even if created on Scaleway Console can be complicated.

tdelmas commented 1 year ago

I'll try to improve the deploy trigger workflow, there is a complete delete/create of triggers each time because there are multiple sources of trigger CRUD (Scaleway Console, API, 3rd party tools etc...).

The current behaviors (after serverless deploy the list of trigger exactly match the list specify in the config) seams correct for me. (Only the implementation needs a little improvement in my opinion)

The case an user wants to remove all of it's triggers even if created on Scaleway Console can be complicated.

If the config file specifies an empty array, it should delete all existing trigger. If the config doesn't specify schedule I think it should do the same.