Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API Issue] cartCreate mutation errors upon startup in headless storefronts #2420

Closed
rylanharper opened this issue Aug 9, 2024 · 1 comment

Comments

@rylanharper
Copy link

rylanharper commented Aug 9, 2024

What is the location of your example repository?

No response

Which package or tool is having this issue?

Storefront API

What version of that package or tool are you using?

2024-07

What version of Remix are you using?

No response

Steps to Reproduce

This morning, I am getting the following error on my cartCreate mutations:

 ERROR  No cart returned from cartCreate mutation { client: 'shopify',
  operationType: 'mutation',
  operationName: 'cartCreate',
  statusCode: 200,
  gqlErrors:
   [ { message: 'Query has a depth of 18, which exceeds the max depth of 17.',
       extensions: [Object] } ] }

The error message indicated an SSR error coming from the Shopify API. This issue was not present yesterday (Aug 8 2024). This issue occurs on my headless storefronts (Nuxt and Next) using the 2024-07 GraphQL API.

Oddly enough, the rest of the API queries and mutations (products, collections, customer, localization, etc.) still work that are non-cart related.

Expected Behavior

The cartCreate mutation and other cart mutations should work when initiated.

Actual Behavior

Currently, the cartCreate mutation does not seem to connect to Shopify and displays the message Query has a depth of 18, which exceeds the max depth of 17.. I am unsure what this message indicates in relation to the API itself.

@rylanharper rylanharper changed the title [API Issue] I am getting the [API Issue] cartCreate mutation errors upon startup in headless storefronts Aug 9, 2024
@rylanharper rylanharper reopened this Aug 10, 2024
@rylanharper
Copy link
Author

rylanharper commented Aug 10, 2024

My mistake on closing this issue.

I found the cause of the issue comes from adding in a ProductOption fragment within a Product query (or fragment) using the 2024-07 API version.

I have the following ProductOption fragment, which is used within my GraphQL product options:

fragment Option on ProductOption {
  id
  name
  optionValues {
    id
    name
    swatch {
      color
      image {
        alt
        id
        previewImage {
          altText
          height
          id
          url
          width
        }
      }
    }
  }
}
options(first: 250) {
  ...Option
}

This causes an error in the cartCreate mutation and causes a Netlify build error:

10:47:12 PM: [error] GraphQL Document Validation failed with 1 errors;
10:47:12 PM:   Error 0: Cannot query field "optionValues" on type "ProductOption".
10:47:12 PM:     at /opt/build/repo/web/queries/shopify/fragments/option.gql:4:3
10:47:12 PM:   Error 0: Cannot query field "optionValues" on type "ProductOption".
10:47:12 PM:   at queries/shopify/fragments/option.gql:4:3

Removing the ProductOption fragment will fix this issue. The issue does not occur when using the ProductOption data from the 2024-04 API version (which does not include the new optionValues object).

Hopefully this helps!

@Shopify Shopify locked and limited conversation to collaborators Aug 12, 2024
@frandiox frandiox converted this issue into a discussion Aug 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant