Solved

Internal error on cartCreate graphql Storefront api endpoint

CookJp
Visitor
2 1 0

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.

Accepted Solution (1)

CookJp
Visitor
2 1 0

This is an accepted solution.

So turns out that the merchandiseId needs to be base64 encoded...

View solution in original post

Reply 1 (1)

CookJp
Visitor
2 1 0

This is an accepted solution.

So turns out that the merchandiseId needs to be base64 encoded...