Getting error in querying category field of product using latest Storefront API

I am getting following error -
GraphqlQueryError: Internal error. Looks like something went wrong on our end.
remix │ Request ID: d498c983-d318-4b59-99da-59ce44922518-1730432785 (include this in support requests)

Following is my query (I am using remix) -

const response = await storefront.graphql(
        `#graphql
            query MyQuery ($searchQuery: String!, $minPrice: Float, $maxPrice: Float ) {
                search(query: $searchQuery, first: 50, productFilters: {price: {max: $maxPrice, min: $minPrice}}, types:PRODUCT) {
                    nodes {
                        ... on Product {
                            handle
                            category { 
                                name 
                            }
                        }
                    }
                }    
            }`,
            {variables: {
                "filterQuery": `${searchQuery}`,
                "minPrice": minPrice,
                "maxPrice": maxPrice,
                },
            },
        );

If I remove category {name} then the query works. I want to query name of category field and the latest (October 2024) storefront api spec (product - Storefront API) shows that category field is there for product. In earlier version it was not there.

1 Like