Shopify Storefront API error from checkoutLineItemsReplace

BashuNaimiRoy
Tourist
10 0 1

I'm receiving a 200 status code response, but the necessary data isn't in the body. Instead I get this object with errors:

 

{"errors":[{"message":"Internal error. Looks like something went wrong on our end.\nRequest ID: 25213b80-95eb-4c02-92b0-9d46e13894a5 (include this in support requests)."}]}

 

Can the Shopify Developer Experience team help me with this one? What is going wrong?

It happens consistently when I go through the following steps:

1. Add products to Cart > Checkout > Progress to the Payment page
2. On the payment page > transition back to the Cart
3. Open the Cart flyout > Attempt to modify/remove the quantities of products in Cart

 

Here is my API request as a fetch method, along with the graphQL query. 

 

 

fetch("https://www.thirdlove.com/api/graphql.json", {
  "headers": {
    "accept": "application/json",
    "accept-language": "en-US,en;q=0.9",
    "content-type": "application/json",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "x-shopify-storefront-access-token": "[redacted]"
  },
  "referrer": "https://www.thirdlove.com/",
  "referrerPolicy": "no-referrer-when-downgrade",
  "body": "{\"query\":\"\\n  mutation checkoutLineItemsReplace($lineItems: [CheckoutLineItemInput!]!, $checkoutId: ID!, $itemsCountLimit: Int) {\\n    checkoutLineItemsReplace(lineItems: $lineItems, checkoutId: $checkoutId) {\\n      checkout {\\n        \\n  id\\n  completedAt\\n  email\\n  currencyCode\\n  subtotalPriceV2 {\\n    amount\\n  }\\n  \\n  lineItems(first: $itemsCountLimit) {\\n    edges {\\n      node {\\n        id\\n        quantity\\n        title\\n        customAttributes {\\n          key\\n          value\\n        }\\n        discountAllocations {\\n          allocatedAmount {\\n            amount\\n          }\\n          discountApplication {\\n            ... on DiscountCodeApplication {\\n              code\\n              applicable\\n            }\\n            ... on ScriptDiscountApplication {\\n              scriptDiscountApplicationTitle: title\\n            }\\n            ... on ManualDiscountApplication {\\n              manualDiscountApplicationTitle: title\\n            }\\n            ... on AutomaticDiscountApplication {\\n              automaticDiscountApplicationTitle: title\\n            }\\n            value {\\n              ... on MoneyV2 {\\n                amount\\n              }\\n              ... on PricingPercentageValue {\\n                percentage\\n              }\\n            }\\n          }\\n        }\\n        variant {\\n          id\\n          availableForSale\\n          sku\\n          product {\\n            id\\n            handle\\n            productType\\n            images(first: 2) {\\n              edges {\\n                node {\\n                  originalSrc\\n                }\\n              }\\n            }\\n          }\\n          selectedOptions {\\n            name\\n            value\\n          }\\n          priceV2 {\\n            amount\\n          }\\n        }\\n      }\\n    }\\n  }\\n\\n  \\n  shippingAddress {\\n    firstName\\n    lastName\\n    address1\\n    address2\\n    zip\\n    city\\n    province\\n    country\\n    phone\\n  }\\n\\n  \\n  customAttributes {\\n    key\\n    value\\n  }\\n\\n\\n      }\\n      userErrors {\\n        code,\\n        message,\\n        field\\n      }\\n    }\\n  }\\n\",\"variables\":{\"checkoutId\":\"Z2lkOi8vc2hvcGlmeS9DaGVja291dC80NTY0ZTI2MDYzNjI3N2Y5ZTJhYWUxZmJmNzFmYzkxMj9rZXk9YmJjZjc2ZmE2OTVkOTFlZGU1OGVmODVhYzk5ZTk0MWY=\",\"lineItems\":[{\"variantId\":\"Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8yNzk5NzU1MDcwNjc5MA==\",\"quantity\":2,\"customAttributes\":[]}],\"itemsCountLimit\":25}}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

 

 

I suspect (but can't prove) that this is related to the checkout ID changing after the payment method has been reached. Can anybody confirm, or give me some more useful information? Thank you in advance for your time.

 

BashuNaimiRoy
Tourist
10 0 1

Updated request ID for anybody looking: 

 

Request ID: 52525361-6ccc-45a2-8505-8d97d63fadf4

0 Likes
BashuNaimiRoy
Tourist
10 0 1

So I just got off the livechat with a Shopify representative, and I was told that this was happening because of a missing translation key in my theme locale file. I'm somewhat confused by this explanation. For the purposes of preventing this in the future, I would like clarification on a couple of points:

  1. Why does the Storefront API depend upon Translation keys? I understand that my calls to update the cart are mutating a Checkout object, but how does that Checkout object depend upon the translation keys in my current theme? Is the Storefront API theme-aware?
  2. How can I get immediate useful information about an error like this in the future, without having to go through Shopify Support and Forums? Is there an error log that I can have access to, or some kind of useful error message such as "you are missing a translation in your theme locale file under the key KEY_NAME_HERE"?

Thank you for your time

0 Likes
BashuNaimiRoy
Tourist
10 0 1

Also somewhat confusingly, the error has ceased to appear since speaking with the representative on livechat. It was easily reproducible before, and now those same steps don't produce the bug, 5 times consistently. I haven't changed anything on my side (I temporarily switched to using the newer version of the API, but reverted and tested with the old version, and it's still not happening).

Has something internal changed? 

Again, my only concern is to prevent this from happening again.

Thank you

0 Likes
_JB
Shopify Staff
Shopify Staff
834 98 188

Hey @BashuNaimiRoy,

JB here, I was assisting Michael during your live chat earlier. I was able to see in the logs that your initial calls weren't specifying an API version, so those calls were defaulting to the lowest version and throwing a generic error message. We've implemented detailed error messaging in 2020-07, which is why I suggested trying that version. I didn't actually expect this to allow the call to work, I thought we'd just see more details about the error.

Can you kindly provide the X-Request-ID value from the response headers of one of your successful calls? I'll use that to find the call in our logs and hopefully spot the difference that's allowing this to work.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

BashuNaimiRoy
Tourist
10 0 1

Hello JB! Thank you for responding. Here's the request ID header from a successful response. I followed the same steps that had previously been reproducing the bug (add products to cart, continue all the way to Payment Step of checkout, return to store page, modify cart / checkout object contents).

x-request-id: a6bf2ea3-c0cf-42f2-9c89-69b7e685178d
0 Likes
BashuNaimiRoy
Tourist
10 0 1

hello @_JB ! If it's possible, I'd like to know if there has been any movement on this.

It's a potentially critical bug, and I'd like to know if there are any answers to my previous question: Why did this translation-related bug happen, and how can I be assured that it won't happen again in the future?

Thank you for your work!

 

0 Likes
BashuNaimiRoy
Tourist
10 0 1

Hello @_JB ! Have there been any new developments on this front, or information you can give me? We're hearing from customers that it is happening still, although we can't reproduce it, and it's somewhat critical. 

Thank you for your time.

0 Likes
BashuNaimiRoy
Tourist
10 0 1

Hello @_JB ! I thought it would be helpful for you to have some x-request-id headers from responses that came back with the same errors recently. here:

 

37d9922e-192f-4b44-9ca9-d449114a5262

98eededf-9efb-437c-94f1-f35ddb45270d
0 Likes