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?
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024