Hi everyone,
I’m experiencing a strange issue with the Shopify Storefront API (version 2025-04).
When I query a collection’s products with filters using fetch in Node.js, the filters array is always empty ([]). However, the exact same query returns the correct filter data (with id, label, type, and values) when I run it using curl.
Code that fails (Node.js):
const response = await fetch(
"https://my-store.myshopify.com/api/2025-04/graphql.json",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Shopify-Storefront-Access-Token": "my-shopify-storefront-access-token",
},
body: JSON.stringify({
query: `
{
collection(handle: "keyboards") {
products(first: 5) {
filters {
id
label
type
values {
id
label
count
}
}
edges {
node {
title
}
}
}
}
}
`,
}),
}
);
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
Result: data.data.collection.products.filters → [] (empty array)
Same query that works with curl:
curl -X POST \
https://nuphy-store.myshopify.com/api/2025-04/graphql.json \
-H "Content-Type: application/json" \
-H "X-Shopify-Storefront-Access-Token: my-shopify-storefront-access-token" \
-d '{
"query": "{ collection(handle: \"keyboards\") { products(first: 5) { filters { id label type values { id label count } } edges { node { title } } } } }"
}'
With curl, the filters array returns properly with all the expected filter values.
What I’ve checked:
- The Storefront Access Token has the correct permissions (including
unauthenticated_read_product_listingsif needed). - The query is identical in both cases.
- No errors are returned in the response (status 200).
- The rest of the data (products edges) returns correctly in Node.js.
Has anyone encountered this before? Is there something special about how Node.js fetch handles the request body or headers that could cause filters to be stripped or not computed?
Any help or insights would be greatly appreciated!
Thanks!
Note: This only happens with
collection.products.filters. Other fields work normally.