API calls blocked :The URL you're calling is not allowed. Fetch calls can only come from 123.xyz.com

viveksharma
Visitor
2 0 1

Hey 

I am trying to create a product subscription App and when I am trying to make an API call I get this error.

The URL you're calling is not allowed. Fetch calls can only come from example.domain.com

Is this expected? How do I fix this and where can I find all the restrictions if any?

Replies 4 (4)

jinseven92
Visitor
1 0 0

Did you manage to solve this?

viveksharma
Visitor
2 0 1

Yes, you can only call the URL specified in the extension settings. But I am still facing issues with local development. 

In local I am getting  The URL you're calling is not allowed. Fetch calls can only come from example.com

CakewalkRussell
Shopify Partner
6 0 4

I think the simplest way to address this currently (if you just want to test things locally) is (as of argo-admin-cli 0.9.3):

  1. Use a tunneled domain so that you have HTTPS service (e.g., ngrok.io, localhost.run, pagekite.me, etc.)
  2. Edit node_modules/@shopify/argo-admin-cli/server/host/Host.tsx and replace the 'example.com' with your tunneled domain
  3. Restart the "shopify serve" command for the extension simulator

Of course, next time you install the application code the settings will be overwritten. But, this will at least get you going until a permanent solution is complete. Make sure that your tunneled domain is also part of the .env.client (or .env.client.local) file used by "shopify serve" (https://www.npmjs.com/package/@shopify/argo-admin-cli/v/0.1.5#environment-variables).

Checkout Simple Subscriptions on the app store for quick and easy subscribe and save plans and more for your stores and clients.
KPC_John
Visitor
1 0 0

Thank you so much for this. Been banging my head figuring out local development.