This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Fix retry token refresh upon network failure and retry refresh upon 5xx errors - #379
Merged
Conversation
kangmingtay
approved these changes
Aug 13, 2022
kangmingtay
left a comment
Member
There was a problem hiding this comment.
good catch @pixtron, this is very nice!
Contributor
Author
|
just recognized i mentioned the wrong PR in the description. It's #301 that introduced the regression. Edited the description as well. |
alaister
approved these changes
Aug 15, 2022
Contributor
|
🎉 This PR is included in version 1.23.0-next.17 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Contributor
|
🎉 This PR is included in version 2.0.0-rc.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
NETWORK_FAILURE.ERROR_MESSAGEis not thrown anymore, without this message failed refresh request are not retryed anymore:https://github.com/supabase/gotrue-js/blob/67a6575102be9c50763ff5d06fd2ee44b18a69f3/src/GoTrueClient.ts#L870-L877
524: A timeout occurred)Resolves: #333
Related to: #289
What is the new behavior?
This PR introduces a new error
AuthRetryableFetchErrorExponential backoff will now retry if this error is returned.handleErrorwill reject withAuthRetryableFetchErrorwhenAdditionaly when
response.json()throws an error (eg. invalid json) the error is caught and the promise is rejected with anAuthUnknownError.In order to test the error handling this PR adds a new dev dependency
jest-mock-server, which let's us setup a mock server that responds with errors or aborts a request without sending any response.