Embedded React UI for a Shopify app fails to use the new App Bridge v4 resource fetching: console shows “postMessage origin mismatch” and “Fetch API cannot load shopify:admin/api/graphql.json. URL scheme ‘shopify’ is not supported.” The global shopify object sometimes exists, but fetch isn’t intercepted/authenticated.
Key causes discussed:
App Bridge script not loaded to handle the shopify: URL scheme.
Direct API access not enabled/propagated in app config.
Possible framework-specific issues (notably Remix).
Reported fixes/workarounds:
Add to the page head: <meta name=“shopify-api-key” …> and even when using @shopify/app-bridge-react.
In shopify.app.toml, enable direct Admin API for embedded apps, then deploy:
[access.admin]
embedded_app_direct_api_access = true
(Some also set direct_api_mode = “online”). Run “shopify app deploy”; propagation may take time (one user suggested ~24h).
Turn off “Development store preview” under App → Extensions to allow direct API.
Manual fetch workaround: include auth header with an ID token:
Authorization: Bearer ${await shopify.idToken()}.
Remix-specific: use admin.graphql from authenticate.admin(request) instead of fetching shopify:admin/api/graphql.json.
Other note: With App Bridge React v4, the Provider wrapper is no longer required.
Status: No single official resolution; multiple user-confirmed fixes above. Discussion remains open, with Remix still seeing issues. Screenshots linked for docs and UI toggles.
Summarized with AI on December 16.
AI used: gpt-5.
I am trying to use a React single-page application as the embedded UI for my Shopify app. I’ve followed the guides on https://shopify.dev/docs/apps/tools/cli to link my Shopify app and set direct API access to online in my shopify.app.toml file. I’ve also ensured that my app configuration has been deployed.
Unfortunately, when I deploy my React app to shopify.mydomain.com, the React app loads in the embedded UI on my test store, but I get the following errors in console in the embedded UI when trying to access the shopify global variable or try to fetch any Shopify API endpoint.
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('<URL>').
index-8r6ap7z6.js:41
Fetch API cannot load shopify:admin/api/graphql.json. URL scheme "shopify" is not supported.
j_ @ index-8r6ap7z6.js:41
(anonymous) @ index-8r6ap7z6.js:49
(anonymous) @ index-8r6ap7z6.js:49
va @ index-8r6ap7z6.js:40
rn @ index-8r6ap7z6.js:40
Vf @ index-8r6ap7z6.js:40
gr @ index-8r6ap7z6.js:38
kh @ index-8r6ap7z6.js:40
hr @ index-8r6ap7z6.js:40
T0 @ index-8r6ap7z6.js:40
T @ index-8r6ap7z6.js:25
N @ index-8r6ap7z6.js:25
index-8r6ap7z6.js:49
TypeError: Failed to fetch
at j_ (index-8r6ap7z6.js:41:133624)
at index-8r6ap7z6.js:49:205
at index-8r6ap7z6.js:49:226
at va (index-8r6ap7z6.js:40:24263)
at rn (index-8r6ap7z6.js:40:42287)
at Vf (index-8r6ap7z6.js:40:36553)
at gr (index-8r6ap7z6.js:38:3274)
at kh (index-8r6ap7z6.js:40:41193)
at hr (index-8r6ap7z6.js:40:40191)
at T0 (index-8r6ap7z6.js:40:35664)
index-8r6ap7z6.js:49
null
This app example is a React-embedded app. This means he already loaded the npm package @shopify/app-bridge-react. The app-bridge.js shouldn’t be included in the @shopify/app-bridge-react npm package?
The alert caution message in the app bridge documentation made me think there was probably something wrong with the way I installed the app bridge library in my code.
I am experiencing the same. Currently migrating to the latest app bridge and cannot get authenticated fetch to work.
I have added the shopify-api-key and script to the head of my index.html
I can confirm that the global shopify object is available and I can launch the new modal using the ui-modal modal element
However, I am getting the same “Fetch API cannot load shopify:admin/api/graphql.json. URL scheme “shopify” is not supported.” error and fetch requests to my own endpoints are not being sent with the authorization headers as described here https://shopify.dev/docs/api/app-bridge-library/reference/resource-fetching
Fetch API cannot load shopify:admin/api/graphql.json. URL scheme “shopify” is not supported.
In the documentation at https://shopify.dev/docs/apps/tools/cli/configuration it is suggested to add a section [access.admin] to shopify.app.toml and that the property “embedded_app_direct_api_access” must be set to true:
I’ve been working on a project, and I’m encountering a similar issue with the developing code. It seems like I’m not the only one facing this challenge.
Has anyone found a successful solution or workaround for this problem?
I find this information helpful. This guide on upgrading components to Shopify App Bridge 4 seems particularly useful. It says that a context provider, which was previously required, is no longer needed.
Replace this:
import {Provider} from '@shopify/app-bridge-react';
return (
);
With this:
return (
My app
);
Now, you don’t need the provider in the latest App Bridge React version.
Can you tell me which framework you utilize (Remix, Next.js, or React)? Additionally, are you able to specify the version of the @shopify/app-bridge-react library you currently use?