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?
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025