App reviews, troubleshooting, and recommendations
Hi. I hope you are having a good day.
I'm working with app proxies to request Shopify admin API but there is an issue. I can connect to the custom API and receive the response successfully. But when I'm trying to connect Shopify API using custom API, it is not working.
I see that the issue is `session` which is undefined when I'm trying to call a request from the Theme extension. So my question is how can I get the session and send it to Shopify API when I'm calling the request from the Theme extension?
Here is my custom API code:
app.get("/products/count", async (_req, res) => { console.log('result', res.locals.shopify) // undefined const countData = await shopify.api.rest.Product.count({ session: res.locals.shopify?.session, }); res.status(200).send(countData); });
And here is the error:
2023-08-03 13:41:55 │ web-backend │ super({ domain: params.session.shop }); 2023-08-03 13:41:55 │ web-backend │ ^ 2023-08-03 13:41:55 │ web-backend │ 2023-08-03 13:41:55 │ web-backend │ TypeError: Cannot read properties of undefined (reading 'shop')
Thanks in advance.
did you found the solution?
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023