Skip to content

fix(payments-next): CartNotCreatedError: Cart not created: Cannot add or update a child row#20655

Merged
elizabeth-ilina merged 1 commit into
mainfrom
PAY-3707-cart-not-created-error-cart-not-created
May 28, 2026
Merged

fix(payments-next): CartNotCreatedError: Cart not created: Cannot add or update a child row#20655
elizabeth-ilina merged 1 commit into
mainfrom
PAY-3707-cart-not-created-error-cart-not-created

Conversation

@elizabeth-ilina
Copy link
Copy Markdown
Contributor

@elizabeth-ilina elizabeth-ilina commented May 27, 2026

Because

  • If a user deletes their account and then navigates to the /new page from a tab where they were signed in, it throws a CartNotCreatedError and shows the 'something went wrong' page, since it attempts to create a cart row with a uid that no longer exists in the accounts table.

This pull request

  • Adds a SetupCartAccountNotFoundError, thrown from CartService.setupCart when the session uid does not resolve to an existing account.
  • /new catches this error and redirects to a new /error page, where the user can sign out and continue with a different account.

Issue that this pull request solves

Closes #PAY-3707

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

STRs:

  1. Make an account, go to checkout
  2. Open another tab, delete account
  3. Go back to tab from step 1, navigate to monthly/new

Screen record from Stage:

Screen.Recording.2026-05-27.at.3.40.58.PM.mov

Fix (local):

Screen.Recording.2026-05-28.at.1.56.12.PM.mov
  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

@elizabeth-ilina elizabeth-ilina force-pushed the PAY-3707-cart-not-created-error-cart-not-created branch from c7ae389 to 3c1b0e6 Compare May 27, 2026 20:10
@elizabeth-ilina elizabeth-ilina marked this pull request as ready for review May 27, 2026 20:12
@elizabeth-ilina elizabeth-ilina requested review from a team as code owners May 27, 2026 20:12
Copy link
Copy Markdown
Contributor

@StaberindeZA StaberindeZA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions/suggestions and just the 1 issue. Looks good otherwise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: create a generic error page, similar to [cartId]/error/page.tsx, instead of one specifically for one error.

This is a non-blocking optional suggestion, since it can be abstracted at a future time when more error pages are required.

@elizabeth-ilina elizabeth-ilina force-pushed the PAY-3707-cart-not-created-error-cart-not-created branch 2 times, most recently from 6a59a49 to c1bd373 Compare May 28, 2026 17:02
… or update a child row

Because:

* If a user deletes their account and then navigates to the /new page from a tab where they were signed in, it throws a CartNotCreatedError and shows the 'something went wrong' page, since it attempts to create a cart row with a uid that no longer exists in the accounts table.

This commit:

* Adds a SetupCartAccountNotFoundError, thrown from CartService.setupCart when the session uid does not resolve to an existing account.
* /new catches this error and redirects to a new /account-not-found page, where the user can sign out and continue with a different account.

Closes #[PAY-3707](https://mozilla-hub.atlassian.net/browse/PAY-3707)
@elizabeth-ilina elizabeth-ilina force-pushed the PAY-3707-cart-not-created-error-cart-not-created branch from c1bd373 to 3cd7e25 Compare May 28, 2026 17:51
Copy link
Copy Markdown
Contributor

@StaberindeZA StaberindeZA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for making the changes

@elizabeth-ilina elizabeth-ilina merged commit 8d09ddc into main May 28, 2026
17 of 19 checks passed
@elizabeth-ilina elizabeth-ilina deleted the PAY-3707-cart-not-created-error-cart-not-created branch May 28, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants