slackapi / node-slack-sdk

Slack Developer Kit for Node.js
https://tools.slack.dev/node-slack-sdk/
MIT License
3.28k stars 662 forks source link

Reg. handling ratelimiting error for chat.update slack api #2010

Closed FirozaSurveySparrow22 closed 1 month ago

FirozaSurveySparrow22 commented 2 months ago

Packages: @slack/web-api - 6.11.1 version

Reproducible in: After crossing the ratelimiting

The Slack SDK version "slack/web-api": "^6.11.1", "slack/logger": "^3.0.0", "slack/types": "^2.11.0",

Node.js runtime version - 14.17.6

I am using chat.update slack api using WebClient of @slack/web-api. The api has ratelimiting of type Web API Tier 3 (50 per minute) and when I have used more that 50 apis per minute, I am getting an info and warning like below but I am not getting any error so that I can catch the error and then I can implement custom backoff strategy to retry the update api after the given retry-after from the rate limit error.

[INFO] web-api:WebClient:1523 API Call failed due to rate limiting. Will retry in 10 seconds. [WARN] web-api:WebClient:1523 http request failed A rate limit was exceeded (url: chat.update, retry-after: 10)

I wanted to implement custom backoff strategy, so I want an appropriate error with retry-after header when ratelimiting occurs. Can you please help in this, if we get the error in the catch block or how does it work. Thank you.

filmaj commented 2 months ago

Have you read the documentation about rate limiting, the event available to listen on, and the option to turn off warning and enable rejection (error) instead? https://slack.dev/node-slack-sdk/web-api#rate-limits

Note that the default rate limit handling in @slack/web-api is to look at the Retry-After information returned by the Slack backend and honour it. The client, therefore, will retry at the soonest possible time.

github-actions[bot] commented 1 month ago

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.

github-actions[bot] commented 1 month ago

As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number.