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.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025