CORS error with NGROk

Adem_Hamidovic
Shopify Partner
2 0 0

Hi all,

I've set up a node/react embedded app using the Shopify CLI and everything was running smoothly until I tried to access the results of a bulk mutation. I'm trying to import all products, so I'm using the bulk mutation to do this in a single call. I have this working, and the resulting object contains a url property that points to a google storage location that contains the product listing. I attempt to make a fetch call and get a 404 error because of a CORS failure.

I then tried to set up my own endpoint to try things out - just a simple endpoint that returns a simple object. This too generates a CORS error:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I've tried using koa/cors, tried explicitly setting the headers on the server object, all to no avail. Any suggestions would be greatly appreciated!

Reply 1 (1)
csam
Shopify Staff
Shopify Staff
267 40 43

Hi @Adem_Hamidovic 

You're not able to connect in the way that you're attempting. I found another forum post that I think explains this really well: 

https://community.shopify.com/c/shopify-apis-and-sdks/blocked-by-cors-policy-response-to-preflight-r...

CS | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog