Script Tag - CORS error when trying to GET data from my app

Overview
I have a custom REST API within my Koa server and I can access it just fine within my Shopify app using react. However, when I try to access it from my Script Tag, I get a CORS error. 

Issue
I can't access my custom REST API data from the script tag, but I can access it from Postman & my React app.

What I tried
1. Install koa/cors and set {origin: *}

Please help me out if you can. Thank you!

proof2.jpgproof1.jpg

◦ Product page slider & thumbnails with swiping for free themes: Minimal | Debut | Brooklyn | Supply
◦ Replace apps with simple copy/paste code snippets. Examples clicking here.
0 Likes
SBD_
Shopify Staff
Shopify Staff
1089 147 199

Can you share a snippet of your Koa app where you configure CORS?

0 Likes

Hello,

Thanks for the reply. I actually ended up finding a solution, the reason was simply because the koa-cors middleware was not before the other middlwares. For anyone who comes across this issue, here is the question and answer on stackoverflow.


◦ Product page slider & thumbnails with swiping for free themes: Minimal | Debut | Brooklyn | Supply
◦ Replace apps with simple copy/paste code snippets. Examples clicking here.
0 Likes