-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to access headers on 429 Responses? #345
Comments
Hi @abmagil,
|
Hi @Khaledgarbaya - I updated my code to be
and re-ran my calls. I saw many Is there a missing step in your solution? I don't seem to ever hit that code. |
Hello. |
closing the issue, if you still need help with this please reach out to Contentful support |
@n-eit
|
Expected Behavior
On error, with
retryOnError
set to false, when I hit the rate limit, I would expect to receive an error that exposes the rate-limit metadata referenced here.Actual Behavior
The error that is sent back is a JS error with string fields that do not include the headers that offer the metadata about how long to wait.
Possible Solution
include a javascript object within the caught error that exposes the
X-Contentful-RateLimit-Hour-Limit
,X-Contentful-RateLimit-Hour-Remaining
,X-Contentful-RateLimit-Reset
,X-Contentful-RateLimit-Second-Limit
,X-Contentful-RateLimit-Second-Remaining
headers.Even better might be to allow me to provide my own Axios client that I could configure myself, which would give me access to the
catch
behavior directly.Steps to Reproduce
retryOnError
set to falseContext
We need to post back to Contentful with an evergreen timestamp in the payload for validation logic which we do on our own. Because we didn't have access to the payload using
retryOnError: true
, we needed to roll our own retry logic. Unfortunately, we then encountered this behavior, which prevents us from rate limiting on our side.Environment
Package Version: "contentful": "7.7.0", "contentful-management": "5.8.0",
Which API are you using?: Management
The text was updated successfully, but these errors were encountered: