[Storefront] Internal Server Error on retrieving multiple varinats

We’ve recently been encountering INTERNAL SERVER issues with the GraphQL Storefront API where if we retrieve the products with more than 8 variants, we get the error: “Internal error. Looks like something went wrong on our end.
|id :6ec383b4-6106-43fb-9b7c-21b89e298769-1748510002"

Here is the GraphQL query
const productFragment = /* GraphQL */ `
fragment product on Product {
id
handle
availableForSale
title
description
descriptionHtml
metafield(namespace: “feature”, key: “list”) {
value
type
}
options {
id
name
values
}
priceRange {
maxVariantPrice {
amount
currencyCode
}
minVariantPrice {
amount
currencyCode
}
}

variants(first:250) {
  edges {
    node {
      id
      # title
      availableForSale
      selectedOptions {
        name
        value
      }
      price {
        amount
        currencyCode
      }
    }
  }
  pageInfo {
  hasNextPage
  endCursor
}
}
featuredImage {
  ...image
}
images(first: 5) {
  edges {
    node {
      ...image
    }
  }
}

Hey @Beitroot_LLC , I see you have also posted here:

If you remove the variants or request a lower amount, does it work then?

@KyleG-Shopify Yes, If i bring the total number of variants to less than 8-10, it works

Thanks. I’m having trouble replicating this on my end. Can you share the specific query you were using and any query filters that may have been applied?

For example is this a product query where this happens on a specific product, or is this a products query returning multiple products?

Also, are you using an app generated storefront access token, or are you using a token generated through one of the headless channels?

Just to add one more thing, I did notice your query is requesting options.values, which is deprecated. I’m not sure it will change anything, but can you replace that with options.optionValues to ensure the full query is using current values.

@KyleG-Shopify I’m using product query to fetch a single product with all available variants and im facing the issue only when i create more number of variants (anything above 8-10+ variants)
Yes, im using a token generated through one of the headless channels

I tried changing options.values to options.optionsValues, still the same

@KyleG-Shopify I also noticied if i add variants one by one from variant details page, the system throws error initially and after sometime it works.

Thanks for doing those test.

About how long after creation do you notice it starts to work? Sounds potentially cache related.

Are you querying product id, or handle? And if you try the opposite of what you are using do you get a different result? https://shopify.dev/docs/api/storefront/latest/queries/product#arguments

@KyleG-Shopify It’s product handle,no i haven’t tried it with id .

@KyleG-Shopify Maybe after a minute

Thanks. Just to make sure I’m fully grasping the issue. You are adding product variants, and on products with more than 8 variants, you get an internal server error on the storefront API for approximately a minute after the variants are added, and after that it starts to work fine?

I’ll test and see if I can replicate that here as well.

@KyleG-Shopify When I try to create all 8 variants at once from the product page, it consistently throws an internal error. However, if I create each variant one by one from the variant details page waiting roughly a minute after adding each, it works without any issues. After that initial delay, the system starts functioning normally.

Thanks for clarifying that.

I tested this on my end by creating a product with no variants initially, then adding 10 color variants and running a similar query to what you shared. The variants took about 15 seconds to appear in the storefront API response, but I didn’t encounter any internal server errors. I was using a storefront access token created through the Hydrogen channel for my testing.

Since I can’t replicate the specific issue you’re experiencing, I’d recommend reaching out to our support team directly. They can take a closer look at your shop configuration and test queries directly on your store with products that are currently in this state. This will help them identify if there’s something specific about the setup or the affected products that might be causing these errors.

Could try add 10 color variants + 6 size size variants as well? in totola 60 variants
@KyleG-Shopify

I added those and I’m still getting a successful response.

Would you be able to test and see if a query using the admin API will work while the storefront API isn’t working; to see if there’s something with the storefront API specifically, or if it’s with the product structure itself.

If it’s only the storefront API, could you create another product that will trigger this error. This time, keep your browser console open to the network tab and log the x-request-id from the mutation that occurs when you save the product. Then share the corresponding storefront API mutation that returns the error. I can then get the logs from both and dig in with our developers to see more clearly what’s happening, since I can’t fully replicate this.

Hey, were you able to attempt those additional tests?

Hey @KyleG-Shopify , Sorry for the delay, as we had some time constraints, we have. move forward with the walk-around-fix, so i couldn’t check follow up through it, allow me some time, i’ll get back to you with the details

1 Like