stencil-cli icon indicating copy to clipboard operation
stencil-cli copied to clipboard

Cart created through Storefront API does not persist within local environment Stencil Context

Open nguyenchris opened this issue 4 years ago • 1 comments

Expected behavior

After creating a new Cart by making a POST request to /api/storefront/carts, adding new line items by making POST requests to /api/storefront/carts/{cartId}/items persists throughout the session.

Upon reload or loading a different page, Stencil context shows cart_id with the value of the created cart ID with the Cart object containing the line items.

Actual behavior

After creating a Cart with the storefront API, POST requests to /api/storefront/carts/{cartId}/items have no issues until 1-5 min. later, the same POST requests return 503 status responses.

Reloading the page will show an empty Cart and cart_id within Stencil context has the value of null

Steps to reproduce behavior

Tested this on 2 different environments. The BigCommerce store that is being used is an Enterprise Sandbox store we have set up that is in maintenance mode.

Environment 1 Stencil CLI: v3.0.3 node: v12.19.0 Browser: Chrome, Safari, Firefox

Environment 2 Stencil CLI: v2.1.1 node: v10.16.3 Browser: Chrome, Safari, Firefox

  1. Start local development server using stencil start
  2. Make POST request to /api/storefront/carts with request body:
{
  "lineItems": [
    {
      "quantity": 5,
      "productId": 107
    }
  ]
}
  1. After 1-5 min of creating Cart, making the same POST request from step 2 returns a 503 response and Stencil Context has the value of null for cart_id with no line items in the cart object.

After the issue occurs, making a GET request to the REST API /checkouts/{checkoutId} returns a successful response with the cart line items that were added through the storefront API--showing that the cart ID/checkout ID still in fact exists.

This issue is making it very difficult to locally develop, especially when it comes to developing changes to our Checkout page since every reload will cause the Checkout/Cart to be empty. Any help would be appreciated.

Screenshots of Request and Response Headers

Successful POST /api/storefront/carts/{cartId}/items

Screen Shot 2020-11-17 at 7 23 26 PM

Failed 503 status response POST /api/storefront/carts/{cartId}/items

Screen Shot 2020-11-17 at 7 22 43 PM

nguyenchris avatar Nov 18 '20 03:11 nguyenchris

Created a ticket for this issue: STRF-8846

MaxGenash avatar Dec 01 '20 17:12 MaxGenash