Unblock network queue and send auth error to sentry#79460
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d78f7295a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
src/libs/Authentication.ts
Outdated
| }).catch((error) => { | ||
| // Ensure we always unblock the network queue, even on unexpected errors | ||
| setIsAuthenticating(false); | ||
|
|
There was a problem hiding this comment.
Keep auth queue blocked for retryable network failures
This new catch runs for all errors thrown inside the reauthenticate chain, including the explicit UNABLE_TO_RETRY error that is thrown to trigger the retry mechanism. Clearing setIsAuthenticating(false) here will unblock the network queue while retryReauthenticate() is still throttling/retrying, so requests can be sent with an expired token and repeatedly bounce through NOT_AUTHENTICATED/reauth cycles. This only surfaces in spotty/offline scenarios where the Authenticate request fails and retries are expected.
Useful? React with 👍 / 👎.
|
@rinej The prettier check is failing. Also, are there any specific test steps for the fix? |
|
I updated the prettier ✅ For QA and testing it might be trickier cause we have to mock the error on the reauth flow, here are the example steps: On dev I added some mock error in the Authenticate function: And trigger the reauthenticate flow e.g. by adding some manual code: After that we should see that error in the Sentry dashboard, e.g. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
After discussing with @rlinoz we decided not to unblock the queue on unexpected error, since the existing retry logic already handles that, and it could cause the some potential issues. So In this PR, we only add tracking the unexpected error and report it to Sentry |
|
🚀 Deployed to staging by https://github.com/rlinoz in version: 9.3.3-0 🚀
|
|
@rinej do we have QA steps here? |
|
Sorry @IuliiaHerets this should have been NO QA, just the normal login testing steps should be enough. |
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.3.3-8 🚀
|
Explanation of Change
Current behavior:
After fix:
Fixed Issues
$ #79210
PROPOSAL:
Example error in Sentry dashboard -> https://expensify.sentry.io/issues/7185638248/?environment=dev&environment=development&query=is%3Aunresolved&referrer=issue-stream
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari