INTERNAL_SERVER_ERROR storefront graphql api response

Hi

I sometimes getting this response when I query to get all products from a collection

[

{

“message”: “Internal error. Looks like something went wrong on our end.\nRequest ID: c4dc1202-d542-47ce-95d1-a2e421cc52d9-1767179922 (include this in support requests).”,

“extensions”: {

“code”: “INTERNAL_SERVER_ERROR”,

“requestId”: “c4dc1202-d542-47ce-95d1-a2e421cc52d9-1767179922”

}

}

]

This is my query and variables

{

“query”: " query($collectionIds: String!, $first: Int!, $after: String, $languageCode: LanguageCode!, $countryVar: CountryCode!) @inContext(country: $countryVar,language: $languageCode) {

collections(first:10, query: $collectionIds) {

nodes {

id

title

handle

products(first: $first, after: $after) {

pageInfo {

hasNextPage

endCursor

}

nodes {

id

title

handle

availableForSale

requiresSellingPlan

images(first: 1) {

nodes {

src

}

}

options {

name

values

}

variants(first: 250) {

nodes {

id

title

price{

amount

currencyCode

}

compareAtPrice{

amount

currencyCode

}

availableForSale

selectedOptions {

name

value

}

image {

id

url

}

sellingPlanAllocations(first: 100) {

nodes {

sellingPlan {

id

}

priceAdjustments {

price {

amount

}

}

}

}

}

}

sellingPlanGroups(first: 100) {

nodes {

sellingPlans(first: 100) {

nodes {

id

name

priceAdjustments {

adjustmentValue {

__typename

… on SellingPlanPercentagePriceAdjustment {

adjustmentPercentage

}

… on SellingPlanFixedAmountPriceAdjustment {

adjustmentAmount {

amount

currencyCode

}

}

… on SellingPlanFixedPriceAdjustment {

price {

amount

currencyCode

}

}

}

}

}

}

}

}

}

}

}

}

} ",

“variables”: {

“collectionIds”: “239046492326”,

“languageCode”: “EN”,

“countryVar”: “IN”,

“after”: null,

“first”: 250

},

“shop”: “dearbball-fr.myshopify.com

}

Hey @Monika_Sharma, I took a look at the logs for request ID c4dc1202-d542-47ce-95d1-a2e421cc52d9-1767179922.

The request timed out - the query was too complex and the server ran out of time trying to fetch all that data before returning a response.

Looking at your query, you’re requesting 250 products with 250 variants each, plus nested selling plan allocations and selling plan groups. That’s a lot of data in a single request. The Storefront API doesn’t have traditional rate limits, but queries that take too long to execute will hit this timeout threshold.

A few things that should help:

  1. Reduce your first parameter for products. Instead of 250, try fetching 10-25 at a time and paginate through the results.

  2. Consider whether you need all 250 variants per product in one go. If products have fewer variants, you could lower that limit and paginate if needed.

  3. The nested selling plan data (sellingPlanAllocations and sellingPlanGroups with 100 items each) adds significant complexity. If you don’t need all that data upfront, consider fetching it separately or reducing those limits.

  4. You might also look at splitting this into multiple smaller queries - one to get product basics, then follow-up queries for variant/selling plan details as needed.

The Storefront API reference has more on query structure, and the API rate limits docs explain how complexity is calculated (even though Storefront doesn’t have the same cost-based limits as Admin API, heavy queries can still time out).

Let me know if you’re still seeing issues after optimizing the query.

1 Like

Hi @Donal-Shopify
Thank you so much for the response. I’ll definitely try to reduce the complexity.
Thanks for the help :slightly_smiling_face: