I’ve gone through the documentation on creating a store-specific custom app, but when I get to the part where I query for the product count, I get the error:
2023-03-16 20:59:46 | backend | /Users/elias/Desktop/zenvy-app/web/node_modules/@shopify/shopify-api/lib/clients/rest/rest_client.js:15
2023-03-16 20:59:46 | backend | throw new ShopifyErrors.MissingRequiredArgument('Missing access token when creating REST client');
Here’s how I’ve configured my shopifyApp:
const shopify = shopifyApp({
api: {
apiVersion: LATEST_API_VERSION,
restResources,
billing: undefined,
},
auth: {
path: "/api/auth",
callbackPath: "/api/auth/callback",
},
webhooks: {
path: "/api/webhooks",
},
sessionStorage: new SQLiteSessionStorage(DB_PATH),
apiKey: process.env.APP_API_KEY,
apiVersion: LATEST_API_VERSION,
apiSecretKey: process.env.ADMIN_API_ACCESS_TOKEN,
isCustomStoreApp: true,
scopes: [
'write_customers',
'write_products'
],
isEmbeddedApp: false,
hostName: process.env.HOST_NAME,
restResources,
});
To get to the above configuration, I first generated the project from npm init @shopify/app@latest app. Then I added additional fields according to the creating a store-specific custom app documentation. As you can see, I have set the apiSecretKey to my Admin API access token (NOT the API secret key), so I’m not sure why it’s not working. Also note that I’ve tried logging all the process.env fields, and they are all correctly configured.
Also just FYI, I noticed that the documentation is partially out-of-date. The line:
const session = shopify.session.customAppSession("my-shop.myshopify.com");
should be:
const session = shopify.api.session.customAppSession("my-shop.myshopify.com");
And same for the shopify.rest commands, where it should be shopify.api.rest
Anyone know how I can resolve the error I am experiencing?
Thanks,
Elias