Internal server error when create cart using storefront API.

fsepulveda
Shopify Partner
3 0 1

Hi, I am getting the following error when calling the storefront api to create a cart and add an item:

 

"{"errors":[{"message":"Internal error. Looks like something went wrong on our end.\nRequest ID: ... (include this in support requests).","extensions":{"code":"INTERNAL_SERVER_ERROR","requestId":"..."}} ]}

 

I am using the official shopify library for PHP, this is the query sent (I modified the one that appears in this example: https://shopify.dev/docs/custom-storefronts/building-with-the-storefront-api/cart/ manage#step-1-create-a-cart-and-add-a-line-item)

 

 

 

$products = $storefrontClient->query(
            data: <<<QUERY
                mutation {
                  cartCreate(
                    input: {
                      lines: [
                        {
                          quantity: 1
                          merchandiseId: "gid://shopify/ProductVariant/..."
                        }
                      ],
                      # The information about the buyer that's interacting with the cart.
                      buyerIdentity: {
                        email: "email@example.com",
                        countryCode: CL
                      }

                    }
                  ) {
                    cart {
                      id
                      createdAt
                      updatedAt
                      lines(first: 10) {
                        edges {
                          node {
                            id
                            merchandise {
                              ... on ProductVariant {
                                id
                              }
                            }
                          }
                        }
                      }
                      buyerIdentity {
                        deliveryAddressPreferences {
                          __typename
                        }
                      }
                      attributes {
                        key
                        value
                      }
                      # The estimated total cost of all merchandise that the customer will pay at checkout.
                      cost {
                        totalAmount {
                          amount
                          currencyCode
                        }
                        # The estimated amount, before taxes and discounts, for the customer to pay at checkout.
                        subtotalAmount {
                          amount
                          currencyCode
                        }
                        # The estimated tax amount for the customer to pay at checkout.
                        totalTaxAmount {
                          amount
                          currencyCode
                        }
                        # The estimated duty amount for the customer to pay at checkout.
                        totalDutyAmount {
                          amount
                          currencyCode
                        }
                      }
                    }
                  }
                }
                QUERY,
        );

 

 

Reply 1 (1)

lukasgjetting
Shopify Partner
5 0 2

I am also experiencing Internal Server Errors when trying to use the `cartCreate` mutation.

 

@fsepulveda Did you find a solution to this? Or is it simply a matter of waiting for Shopify?