Can't call api from koa server inside Nextjs app

Cheeze
New Member
3 0 0

Hi I've been trying to call my proxy api in my custom app but it returns "405 Method Not Allowed". However, when I paste my proxied api in Google chrome with my store logged in I can reach my endpoint.

 

Flow: I fetch https://{{store_url}}/apps/hb-core/api/product in React app it 405 Method Not Allowed, CORS Missing Allow Origin.

 

Untitled1.png

 Fetch code:

fetch('https://{{store_url}}/apps/hb-core/api/product')

 

When I call the same url in Google Chrome, the result is success:

Untitled2.png

 

Some additional info:

1) My react app is hosted together with koa server, all created with the Shopify CLI

2) The proxy seems to work when it's called from Liquid script tag, and also injected script tags. The only place it doesn't work is in the Shopify app.

 

Am I calling it wrong in my React app??

 

Hope someone can help shed some light on this issue.

 

Thanks!

 

Replies 3 (3)
Cheeze
New Member
3 0 0

Still looking for an answer...

wahbii
New Member
1 0 0

Hey,

 

I am facing the same issue. Did you found any solution for it ?

 

Thanks

Cheeze
New Member
3 0 0

Hi,

 

Yes. Shopify Proxy URL won't work if you call it inside an app. Use the ngrok url instead and it should work.