You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though I entered the storeDomain and publicAccessToken values correctly and the Shopify support team verified that these values were correct,
I am encountering the error Storefront API Client: a valid store domain must be provided.
Has anyone encountered this problem before? In the application I created, all permissions in the Storefront API access scopes section have been granted.
Can someone with knowledge on this subject help?
Here is my code:
import { createStorefrontApiClient } from '@shopify/storefront-api-client';
const client = createStorefrontApiClient({
storeDomain: 'http://domain-name.myshopify.com/',
apiVersion: '2024-07',
publicAccessToken: 'store-front-api-here'
});
export const fetchCollectionByHandle = async (handle) => {
const query = `
query {
collectionByHandle(handle: "${handle}") {
id
title
products(first: 10) {
edges {
node {
id
title
description
images(first: 1) {
edges {
node {
url
}
}
}
}
}
}
}
}
`;
try {
const response = await client.query({
data: query
});
const products = response.data;
if (!products || products.length === 0) {
throw new Error('No products found in this collection.');
}
return products;
} catch (error) {
console.error('Error fetching products by collection handle:', error);
return [];
}
};
Thanks,
The text was updated successfully, but these errors were encountered:
Hi everyone,
Even though I entered the storeDomain and publicAccessToken values correctly and the Shopify support team verified that these values were correct,
I am encountering the error Storefront API Client: a valid store domain must be provided.
Has anyone encountered this problem before? In the application I created, all permissions in the Storefront API access scopes section have been granted.
Can someone with knowledge on this subject help?
Here is my code:
Thanks,
The text was updated successfully, but these errors were encountered: