Re: Hydrogen Storefront Mutation Error

Solved

Why does my Hydrogen website show a mutation error when trying to add to cart?

g3misa
Shopify Partner
24 5 15

Hi, this just happened about 4 hours ago.  When trying to Add to Cart on my Hydrogen website, this internal error occurs.  My hydrogen version is v2023.7.7.  My node version is v18.17.0.  Thanks in advance.

 


Error: [h2:error:storefront.mutation] Internal error. Looks like something went wrong on our end. Request ID: 756e3a8e-0807-44fd-884d-742827eaea62 (include this in support requests). - Request ID: 756e3a8e-0807-44fd-884d-742827eaea62 at throwError (/node_modules/@shopify/hydrogen/src/storefront.ts:450:5) at fetchStorefrontApi (/node_modules/@shopify/hydrogen/src/storefront.ts:339:7) at processTicksAndRejections (node:internal/process/task_queues:95:5) at cartCreate (/app/routes/($lang)/cart.tsx:496:24) at action (/app/routes/($lang)/cart.tsx:118:18) at callRouteActionRR (/node_modules/@remix-run/server-runtime/dist/esm/data.js:31:16) at callLoaderOrAction (/node_modules/@remix-run/router/router.ts:3671:16) at submit (/node_modules/@remix-run/router/router.ts:2829:16) at queryImpl (/node_modules/@remix-run/router/router.ts:2764:22) at Object.queryRoute (/node_modules/@remix-run/router/router.ts:2714:18)

 

Let's solve problems together!
Accepted Solution (1)
g3misa
Shopify Partner
24 5 15

This is an accepted solution.

Was able to fix the issue which was in the Graphql mutation.  For some reason the CartFragment used to work with the merchandise property in the node.  Now that throws an error.    Just had to remove it and make a separate query to get it.   

 

https://github.com/Shopify/hydrogen/discussions/1561

Let's solve problems together!

View solution in original post

Replies 4 (4)

Filiph
Shopify Partner
7 1 5

Yeah; mutations have been broken for roughly the same amount of time. Support is no help at all; seems like they haven't been trained at all on how to deal with minor outages or what the storefront API even is. (Interestingly enough though; mutations work fine through the graphiql app; I'm considering just throwing up a hacky solution to "abuse" it for cart mutations in the meanwhile https://shopify-graphiql-app.shopifycloud.com/api/2023-10/graphql)

// Filiph, CTO at Nordcom Group Inc.
g3misa
Shopify Partner
24 5 15

Looks like it now forces us to use these types:

 

node_modules/@shopify/hydrogen/dist/production/index.d.ts 

 

rather than:

 

node_modules/@shopify/hydrogen/dist/storefront-api-types.d.ts

 

I will now need to refactor a LOT of code  😢 

 

 

Let's solve problems together!
Filiph
Shopify Partner
7 1 5

I'm not using remix/hydrogen, I might hate myself but not enough to use remix. I'm using hydrogen-react with nextjs not that it matters.

Typings would have nothing to do with a backend error, an INTERNAL_SERVER_ERROR (or a 500) is a server error while a 400 would be an error on our end.

 

AND even if it was on our end you don't just push breaking changes without warning; you deprecate and notify.

// Filiph, CTO at Nordcom Group Inc.
g3misa
Shopify Partner
24 5 15

This is an accepted solution.

Was able to fix the issue which was in the Graphql mutation.  For some reason the CartFragment used to work with the merchandise property in the node.  Now that throws an error.    Just had to remove it and make a separate query to get it.   

 

https://github.com/Shopify/hydrogen/discussions/1561

Let's solve problems together!