Issue with Fetch Requests from Admin Extension to Remix Route in Production (Fly.io)

Issue with Fetch Requests from Admin Extension to Remix Route in Production (Fly.io)

santoshBhasker
Shopify Partner
1 0 0

Hello Shopify Community,

I've developed a Shopify app using the Shopify Remix package and created an admin extension. This extension posts a fetch request to a Remix route, which then calls a third-party API and Shopify Admin APIs (both GraphQL and REST) to perform various tasks. Everything worked perfectly in my local environment, but I am encountering issues in the production environment deployed on Fly.io.

Details:

  1. Environment: Shopify app built with Remix, deployed on Fly.io.
  2. Issue: Initially faced a CORS error, which was resolved by installing Remix utils. However, the fetch requests from the admin extension to the Remix route still face issues in production.
  3. Requirement: Guidance on setting up and handling fetch requests from the admin extension to the Remix route, including accessing Shopify Admin APIs and processing the request body in the POST request from the extension.

Additional Context:

  • The fetch request is supposed to interact with a third-party API and Shopify Admin APIs to get some tasks done.
  • The setup works fine in the local environment, but not in production.
  • The CORS error was resolved, but there are still issues with making the requests successfully.

Could anyone provide detailed steps or insights on how to achieve this in production? Any help would be greatly appreciated!

Thank you in advance!

Reply 1 (1)

attaboiaj
Shopify Partner
30 4 16

Ok if your case is not similar to this post of mine
https://community.shopify.com/c/shopify-apps/cors-issue-from-quot-shopify-demo-store-via-my-theme-ex...

and seems like its not and you are trying to call external API from "Shopify admin" then you should try Proxy URL 

Ref:
https://shopify.dev/docs/apps/build/online-store/display-dynamic-data

Start from here and just search on YT there are some videos explaining this concept