Skip to content
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

[bug]: Expired guest cart for Venia (server error) #1143

Closed
6 tasks
ericerway opened this issue Apr 15, 2019 · 4 comments · Fixed by #1150
Closed
6 tasks

[bug]: Expired guest cart for Venia (server error) #1143

ericerway opened this issue Apr 15, 2019 · 4 comments · Fixed by #1150
Assignees
Labels
bug Something isn't working expedite

Comments

@ericerway
Copy link

Describe the bug
After 20 minutes using a guest cart, an error message of "500 Internal Server .." appears which is a false positive.

To Reproduce
Steps to reproduce the behavior:

  1. Add an item to cart in Venia (guest)
  2. Allow cart to expire (~20 minutes)
  3. 500 Internal Server message shown

Expected behavior
No error message shown.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Possible solutions
Add any ideas about possible solutions to the problem here.

Please complete the following device information:

  • Device [e.g. iPhone6, PC, Mac, Pixel3]:
  • OS [e.g. iOS8.1, Windows 10]:
  • Browser [e.g. Chrome, Safari]:
  • Browser Version [e.g. 22]:
  • Magento Version:
  • PWA Studio Version:
  • NPM version npm -v:
  • Node Version node -v:

Please let us know what packages this bug is in regards to:

  • venia-concept
  • pwa-buildpack
  • peregrine
  • pwa-devdocs
  • upward-js
  • upward-spec
@ericerway ericerway added bug Something isn't working expedite labels Apr 15, 2019
@supernova-at supernova-at self-assigned this Apr 18, 2019
@supernova-at
Copy link
Contributor

supernova-at commented Apr 18, 2019

I'm currently waiting for the 20 minutes to expire, but just looking at the retry logic I think there's an infinite loop there:

clearGuestCartId clears the cart ID from local storage, but never from the Redux store.
When createGuestCart attempts to create a new cart immediately after that, it early outs because there is a cart ID stored in Redux:

        // if a guest cart already exists, exit
        if (cart.guestCartId) {
            return;
        }

It then retries the operation, but it will keep failing because it will keep trying to use the cart ID stored in Redux.

@supernova-at
Copy link
Contributor

supernova-at commented Apr 18, 2019

Reproduction Steps (bad cartId in local storage):

  1. Change the value of the guestCartId cookie to something bogus
  2. Fully refresh the page
  3. See the Error toast

Not that this does not exercise the ErrorView path (with the "500 Internal Server Error" message), just the error toast.

@supernova-at
Copy link
Contributor

supernova-at commented Apr 19, 2019

Reproduction Steps (bad cartId in Redux):

Prerequisite

  1. Install the Redux DevTools Extension

Add Item

  1. Launch Venia and wait for a successful initialization (look for a successful CART/GET_DETAILS/RECEIVE message in the console)
  2. Open Redux DevTools
  3. In the text area at the very bottom, enter the following:
{
type: 'CART/GET_GUEST_CART/RECEIVE',
payload: 'Bogus!'
}

and click the small dispatch button in the lower right to dispatch an action that will set cart.guestCartId to "Bogus!"

  1. Attempt to add an item to your cart
  2. See the Error toast appear
  3. See the retries result in an infinite loop of error toasts

Update Item

  1. Open the cart item edit dialog from the mini cart
  2. Open Redux DevTools
  3. In the text area at the very bottom, enter the following:
{
type: 'CART/GET_GUEST_CART/RECEIVE',
payload: 'Bogus!'
}

and click the small dispatch button in the lower right to dispatch an action that will set cart.guestCartId to "Bogus!"

  1. Select some product options and click the Update Cart button
  2. See the Error toast appear
  3. See the retries result in an infinite loop of error toasts

Remove Item

  1. Open the mini cart
  2. Open Redux DevTools
  3. In the text area at the very bottom, enter the following:
{
type: 'CART/GET_GUEST_CART/RECEIVE',
payload: 'Bogus!'
}

and click the small dispatch button in the lower right to dispatch an action that will set cart.guestCartId to "Bogus!"

  1. Select Remove Item for any item in the cart
  2. See the Error toast appear
  3. See the retries result in an infinite loop of error toasts

Not that these do not exercise the ErrorView path (with the "500 Internal Server Error" message), just the error toasts.

@supernova-at
Copy link
Contributor

supernova-at commented Apr 19, 2019

Also try a bogus bearer (signin) token to try and reproduce the 500 Internal Server Error message.

Edit: Tried this, nothing changed. Application hangs when attempting to add item to cart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working expedite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants