CORS issue with Custom App

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 :slight_smile:

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.

This topic was solved and automatically closed 15 days after the last reply. New replies are no longer allowed.