Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
request to the cartCreate endpoint fails with:
{"errors":[{"message":"Internal error. Looks like something went wrong on our end.\nRequest ID: 83187120-fadb-425c-8d50-f3740ed080f0 (include this in support requests).","extensions":{"code":"INTERNAL_SERVER_ERROR","requestId":"83187120-fadb-425c-8d50-f3740ed080f0"}}]}
The request used:
curl --request POST \
--url https://{shop}.myshopify.com/api/2022-07/graphql.json \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Storefront-Access-Token: {token}' \
--cookie request_method=POST \
--data '{"query":"mutation cartCreate($input: CartInput) {\n\tcartCreate(input: $input) {\n\t\tcart {\n\t\t\tcheckoutUrl\n\t\t}\n\t\tuserErrors {\n\t\t\tfield\n\t\t\tmessage\n\t\t}\n\t}\n}\n","variables":{"input":{"lines":[{"merchandiseId":"gid://shopify/ProductVariant/12510958198893","quantity":1}]}},"operationName":"cartCreate"}'
Any ideas what the problem is here? It's hard to dig any deeper from outside the API.
Interestingly it does throw a regular, expected error if the merchandiseId does not exist. It only errors like this if the product exists.
Solved! Go to the solution
This is an accepted solution.
So turns out that the merchandiseId needs to be base64 encoded...
This is an accepted solution.
So turns out that the merchandiseId needs to be base64 encoded...