-
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
Retry is broken #277
Comments
Related Axios issue: axios/axios#1718 |
Hi @TomiTakussaari, |
@Khaledgarbaya Contentful-sdk seems to be still using Axios 0.18, which does not have this problem. Problem is with Axios 0.19 beta (and above), as documented in axios/axios#1718. This version is used in Contentful.js 7.1.0-beta0, that we have to use because of other problems with earlier, contentful bundled, version of Axios. As I see it, because 'instance.defaults.retryOnError' on rate-limit.js will always be undefined with Axios 0.19, retry just won't work, regardless of status code. There also does seem to be test for retrying on network error here (unknown status code): https://github.com/contentful/contentful-sdk-core/blob/master/test/unit/rate-limit-test.js#L89, and network error retry related code here: https://github.com/contentful/contentful-sdk-core/blob/master/lib/rate-limit.js#L20. If those use cases are not supported, perhaps those should be removed to avoid any confusion? |
Hey @TomiTakussaari contentful.js is using axios 0.18 also https://github.com/contentful/contentful.js/blob/master/package.json#L61. Also, you are replying with an error without a status, which means that the response exist so it is not a connection error for the ratelimit logic Best, |
This version of contentful.js is not using axios 0.18: https://github.com/contentful/contentful.js/releases/tag/v7.1.0-beta0 & Line 61 in c1b7286
I understand its a beta version, but I guess bugs in it should still be reported here ? Also, retry for this error does work with 7.0.3:
|
Hey @TomiTakussaari, |
Hey @TomiTakussaari, Best, |
Any news @Khaledgarbaya ? |
havin timeout errors up the wazoo - is this related possibly?
|
this should be fixed in the latest release, Please open a new issue if you still have the issue |
Expected Behavior
By default, this SDK is retrying requests which resulted in a 500 server error and 429 rate limit response.
Actual Behavior
Contentful.js does not seem to retry errors:
Fails with:
Possible Solution
I'm not that familiar with Axios or contentful.js, but it looks like Axios ignores keys it does not know, like
retryOnError
, which means that retryOnError is not be available for retry-handlerIt looks like this behaviour was changed in axios/axios#1395
Context
We are using beta version of contentful.js because of this issue: #272
Now, I have seen a few 429 and ECONNRESET errors on our site, and wondered why those are visible to our clients, when Contentful.js should be retrying those.
So, I decided to create nock-based test for checking out what happens, and based on that, retry does not seem to work.
Environment
Edit:
I did test this with 7.0.3, and it does not seem to have this problem.
The text was updated successfully, but these errors were encountered: