Re: "Internal Error" When Querying product variant storeAvailability On The Storefront API

"Internal Error" When Querying product variant storeAvailability On The Storefront API

huykon225
Shopify Partner
5 0 0

Storefront API Version: 2023-07.

What I'm trying to do: Query `storeAvailability` data associated with a product variant.

the query:

query getStoreAvailability($handle: String!) {
    product(handle: $handle) {
      availableForSale
      variantBySelectedOptions(selectedOptions: {name: "Color", value: "Ice"}) {
        sku
        title
        weight
        quantityAvailable
        storeAvailability(first: 1) {
          edges {
            node {
              available
              pickUpTime
              location {
                name
              }
            }
          }
        }

      }
    }
  }

which returned:

Unexpected Server Error

Error: Internal error. Looks like something went wrong on our end.
Request ID: e49c46aa-80d3-4815-9e45-68e8acf8da1b (include this in support requests).

Is this a bug in the Storefront API, or is there another issue at play?

Replies 2 (2)

Liam
Community Manager
3108 341 881

Hi Huykon225,

 

The error message you're seeing usually indicates an issue on the server side. However, it could also be due to an error in your query. The Storefront API is quite particular about the structure and syntax of the queries it receives.

Here's a few things to check:

  1. Make sure that the $handle variable you're passing into the query is a string and that it corresponds to an existing product in the store.

  2. Ensure that the selectedOptions you're querying actually exist for the product variant. In your query, you're querying for the variant where the option name is "Color" and the value is "Ice". If no such variant exists, this could potentially cause an issue.

  3. The storeAvailability field is only available on the Variant object, and it's possible that not every variant will have this field. If you're querying a variant that doesn't have storeAvailability data, this might cause an error.

  4. Make sure that the API version you're using (2023-07) is correct and supports the fields you are querying.

Let us know here after checking these points you're still experiencing the issue, since it could be a bug or temporary issue with the Storefront API. Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

huykon225
Shopify Partner
5 0 0

Hi @Liam ,
Thank for your responding. I can make sure all of my input & product data have enough as your mention above. I'm also using the latest version of API is 2023-07 . Please check the API help me.
Thanks