"/api/shopify/product-update" issue vercel functions for product syncing - help please
musaa-muhsen opened this issue · 4 comments
Hi, I'm just wondering please if you could help with the product syncing issue that I'm having so I'm aware you have to change or add products in order to trigger the webhook, however, I'm getting this error (shown below pic 1) on Vercel functions so no products are being added to Sanity. I've added the live URL also (shown below pic 2). Is there a setting not included maybe? Picture 3 is the .env settings for Vercel I thought I might add.
Also, the only thing I added to /studio .env.development and .env.production was SANITY_STUDIO_PREVIEW_SECRET as well, is this correct?
Once again a great project and any help would be much appreciated. Thanks
Hey there @musaa-muhsen, sorry for the delay in getting back to you!
This is interesting and a bit hard to debug from your screenshots. Was this a manual or auto setup?
In your first screenshot, it appears that you're being denied access to read/write from Shopify in the sync function. Are you sure you added the correct Storefront API keys and added the correct API Scopes for each? (please check the setup instructions)
As for the last error you sent that shows a CORS error, I'm not sure what that's coming from, as there's no CORS settings for the Shopify side of things. That's only required for Sanity, ensuring that it can be accessed from different domains.
Let me know if you can confirm the above and if there's any other error logging you can share!
Hi @ndimatteo ,
No worries thanks for getting back to me. I realised after the local version CORS wasn't set up but already did have it for the live version I did check the Storefront API key thoroughly several times but to no avail. It was driving me mad trying to figure it out so I ended up creating my own setup inspired by your own.
However, I was wondering if you could help me with something still please so I’m aware that you have a theme.liquid, I’m assuming this is for the account login side of things only? And portals to the “online store” I’m assuming? It would be great to know how you went about tackling the account part when you have a moment.
Thanks, M
No problem @musaa-muhsen, I wish we could figure out what was causing you issues, I'm sure it was just a misconfiguration somewhere.
As for the theme.liquid
file, that's to properly redirect to the headless storefront when one of the Shopify native product/collection URL paths is hit. It bypasses account-related paths so that those can still be handled through Shopify native.
Closing this for now, but if you end up going back to HULL for your headless setup and have questions feel free to open another issue!