Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

CORS issue with Custom App

Topic Labels: Custom Extensions
883 1
Showing results for 
Search instead for 
Did you mean: 

Hey! I’m currently making the first steps with the Blocks SDK and having problems with fetching data from our Shopify Backend.

I’m trying to do it like this (frontend.js):
let url =${record.getCellValue("Shopify Id")}
let response = await fetch(url,{
method: ‘GET’,
headers: {
‘Content-Type’: ‘application/json’,
‘X-Shopify-Access-Token’: ‘xyz’,
return await response.json()

Whenever I trigger this function, the console logs say:
Access to fetch at '' from origin '' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

Any help with this will be much appreciated :slightly_smiling_face:

1 Reply 1

Hi @Dominik_Fischer ,

I don’t know if the Shopify API is intended to be accessed from the browser. Shopify seems to be limiting the origins that the request can be made from if you’re dong it from the browser. I suggest making a request to a server of yours and having that server make the Shopify API request.