Can't get started with js-buy-sdk - product_listings 404 (Not Found)

Highlighted
New Member
5 0 0

I'm trying to use the js-buy-sdk but cannot fetch any products. The code I'm using to setup the client and fetch products is here:

========================================================================
<script src="http://sdks.shopifycdn.com/js-buy-sdk/v0/latest/shopify-buy.umd.polyfilled.min.js"></script>
<script>
var client = ShopifyBuy.buildClient({
accessToken: "ACCESS TOKEN",
domain: "myshop.myshopify.com",
appId: 6
});

client.fetchAllProducts().then(function(products) {});

var productId = 1234567;
client.fetchProduct(productId).then(product => {});
========================================================================

I get 404 errors for fetching all products and fetching a specific product:

========================================================================
product_listings:1 GET https://myshop.myshopify.com/api/apps/6/product_listings 404 (Not Found)
shopify-buy.umd.polyfilled.min.js:1 Uncaught (in promise) Error: Not Found
at h (shopify-buy.umd.polyfilled.min.js:1)
at <anonymous>
h @ shopify-buy.umd.polyfilled.min.js:1
Promise rejected (async)
(anonymous) @ index.html:34
1234567:1 GET https://myshop.myshopify.com/api/apps/6/product_listings/1234567 404 (Not Found)
shopify-buy.umd.polyfilled.min.js:1 Uncaught (in promise) Error: Not Found
at h (shopify-buy.umd.polyfilled.min.js:1)
at <anonymous>
========================================================================

I've made sure the product ID is available to the app. Changing the access token to something wrong gives a permission denied error so I'm sure that part is right.

What am I doing wrong? How can I debug this?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1555 81 287

Hey there.

Are you ensuring that the product(s) in question is/are published to your private app? If not, we will return a 404. Unless that's what you mean when you say:

I've made sure the product ID is available to the app.

... in which case let me know. I could try replicating myself if you want to indicate the shop/product ID in question.

Cheers.

0 Likes
Highlighted
New Member
5 0 0

Resurrecting this old thread because I'm having this exact same issue... I'm not sure if I've published the products in the private app - how is that done?

0 Likes