We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How to resolve a GraphQL query error in an ecommerce platform?

Solved

How to resolve a GraphQL query error in an ecommerce platform?

vishnuAcodez
Shopify Partner
2 1 0
const graphqlClient = new shopify.api.clients.Graphql({ session });
try {
const data = await graphqlClient.query({
data: `query {
shopLocales {
locale
primary
published
}
}`,
});
console.log(data?.body?.data);
} catch (error) {
console.log(error);
}
 
I'm getting "GraphqlQueryError: GraphQL query returned errors" while using the above code , Any solution for fix?
Accepted Solution (1)

vishnuAcodez
Shopify Partner
2 1 0

This is an accepted solution.

read_locales scope was not given

View solution in original post

Replies 2 (2)

vishnuAcodez
Shopify Partner
2 1 0

This is an accepted solution.

read_locales scope was not given

richardcobain
Trailblazer
160 7 22

Hi!

The error likely stems from missing API permissions, so ensure your app has access to shopLocales. Double-check your query structure against Shopify’s GraphQL schema to ensure it’s correct. Use Shopify's GraphiQL app to test the query and identify specific issues. Also, review the full error message for hints and ensure your Shopify API library is up to date. Let me know if this helps!