Conversation
## Because - Routes that send a push notification show 1-3 minute timeouts in Grafana. A push send can take a minute or longer while it contacts APNS, and the client waits on it. - `notifyAccountUpdated` sat inside the `try` of `accountAndTokenVerification`, whose `catch` rethrows. A push failure could turn a successful sign-in confirmation into a 500 after the database write had already committed. ## This pull request - Drops the `await` on `push.sendPush` in `devices-and-sessions.js`, and on `push.notifyDeviceConnected` and `push.notifyAccountUpdated` in `emails.js`. - Adds a `.catch()` that logs at each of the three sites. `push.js` rethrows per-device send errors, so a bare floating promise would become an unhandled rejection. - Adds a test per site. The `devices-and-sessions` test holds the send pending, so an accidental re-`await` hangs the test instead of passing. - Leaves `notifyCommandReceived` awaited. That route returns `notified` and `notifyError` in its response body, so the push result is part of the API contract. ## Issue that this pull request solves Closes: https://mozilla-hub.atlassian.net/browse/FXA-5807
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents slow push sends from blocking auth-server responses while safely logging rejected promises.
Changes:
- Makes three push notifications fire-and-forget.
- Adds rejection logging and regression tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
emails.js |
Makes two verification-flow notifications non-blocking. |
emails.spec.ts |
Tests rejection logging and successful responses. |
devices-and-sessions.js |
Makes device notifications non-blocking. |
devices-and-sessions.spec.ts |
Tests response timing and rejection logging. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
This PR lgtm, it is small and well scoped, r+ |
toufali
approved these changes
Sep 1, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Because
notifyAccountUpdatedsat inside thetryofaccountAndTokenVerification, whosecatchrethrows. A push failure could turn a successful sign-in confirmation into a 500 after the database write had already committed.This pull request
awaitonpush.sendPushindevices-and-sessions.js, and onpush.notifyDeviceConnectedandpush.notifyAccountUpdatedinemails.js..catch()that logs at each of the three sites.push.jsrethrows per-device send errors, so a bare floating promise would become an unhandled rejection.devices-and-sessionstest holds the send pending, so an accidental re-awaithangs the test instead of passing.notifyCommandReceivedawaited. That route returnsnotifiedandnotifyErrorin its response body, so the push result is part of the API contract.Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-5807
Checklist
Put an
xin the boxes that applyHow to review (Optional)
lib/routes/emails.jsandlib/routes/devices-and-sessions.jsnotifyAccountUpdatedsite. A push failure there no longer fails the request, so the caller now gets a 200 where it used to get a 500.Screenshots (Optional)
No user interface change.
Other information (Optional)
npx jest --selectProjects unit --findRelatedTestsover the four files: 220 passed, 0 failed.npx nx lint fxa-auth-server: exit 0.routes/account.ts,routes/password.ts,routes/utils/signup.js,lib/devices.js, andemails.jsnotifyProfileUpdated) that carry no.catch(). They look like the same latent unhandled-rejection risk, but this change leaves them alone to stay narrow.