Issue summary
Using the template in order to build a custom shopify app works smoothly and deploying to render.com works mostly fine but calling /api/products/count fails with 401 if authorization is needed (i.e. where reading data from shopify session)
Expected behavior
Having the result of the product count when calling web endpoint /api/products/count
Actual behavior
401 Unauthorized (nginx log)
Steps to reproduce the problem
- test the app works smoothly locally (via 'shopify app dev') where it calls GET /api products/count and POST /api/products
- after step 1 confirmed ok: deploy in render (Dockerfile and nginx.conf double checked? yes. set env vars on render? yes)
- check the app is deployed correctly (static files are all 200) and any custom web endpoint (where auth is not needed) gives 200
- call /api/products/count (in the ProductsCard.jsx react component): the count and button will keep loading and the console will give 401 unauthorized for /api/products/count
Possible solution (tested)
we solved via modifying web/frontend/vite.config.js reverting the following update cited in the Readme:
2. Change the server.host setting in the configs to "localhost":
server: {
host: "localhost",
with this fix (on hosting service render.com or any other service with similar issue)
#reverting to server.host for production envs
server: {
host: "server.host"
Issue summary
Using the template in order to build a custom shopify app works smoothly and deploying to render.com works mostly fine but calling /api/products/count fails with 401 if authorization is needed (i.e. where reading data from shopify session)
Expected behavior
Having the result of the product count when calling web endpoint /api/products/count
Actual behavior
401 Unauthorized (nginx log)
Steps to reproduce the problem
Possible solution (tested)
we solved via modifying web/frontend/vite.config.js reverting the following update cited in the Readme:
with this fix (on hosting service render.com or any other service with similar issue)