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
Describe the bug
When using the following method: client.collection.fetchWithProducts(collectionId, {productsFirst: number})
An error occurs: TypeError: Network request failed. My code is correct because it works in TestFlight mode, but it does not work in dev client mode. The issue only appears on a Mac machine. There are no problems on Windows with Android device; the error only occurs with a React Native application launched from a Mac (iOS as well as Android phone).
To Reproduce
Steps to reproduce the behavior:
npx expo start
use dev client
launch project on physical device iOS or Android.
call the fetchWithProducts method
import Client from 'shopify-buy';
// Initialize Shopify-buy SDK
const client = Client.buildClient({
domain: process.env.EXPO_PUBLIC_SHOPIFY_DOMAIN,
storefrontAccessToken: process.env.EXPO_PUBLIC_SHOPIFY_STOREFRONT_TOKEN,
});
//Fetch a specific collection by a collection ID
const fetchCollectionProducts = async (collectionId: string) => {
try {
const response = await client.collection.fetchWithProducts(collectionId, { productsFirst: 25})
if (response && response.products) {
return response.products;
} else {
// return empty array if no products
return [];
}
} catch (error) {
console.error(Error fetching products for collection ${collectionId}:, error);
return [];
}
Expected behavior
This function should return the products from the Shopify database.
Additional context
All tests were conducted on physical devices. The "network request failed" error generally occurs when making a call to a local back-end, but here we are calling the Shopify API via the shopify-buy library, so I do not understand this error.
Thank you for reading,
Screens
The text was updated successfully, but these errors were encountered:
Describe the bug
When using the following method:
client.collection.fetchWithProducts(collectionId, {productsFirst: number})
An error occurs: TypeError: Network request failed. My code is correct because it works in TestFlight mode, but it does not work in dev client mode. The issue only appears on a Mac machine. There are no problems on Windows with Android device; the error only occurs with a React Native application launched from a Mac (iOS as well as Android phone).
To Reproduce
Steps to reproduce the behavior:
npx expo start
use dev client
launch project on physical device iOS or Android.
call the fetchWithProducts method
Expected behavior
This function should return the products from the Shopify database.
Environment:
Additional context
All tests were conducted on physical devices. The "network request failed" error generally occurs when making a call to a local back-end, but here we are calling the Shopify API via the shopify-buy library, so I do not understand this error.
Thank you for reading,
Screens
The text was updated successfully, but these errors were encountered: