CORS issue with Custom App

Topic Labels: Custom Extensions
1464 1
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

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
6 - Interface Innovator
6 - Interface Innovator

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.