Hi everyone,
I’m building a Shopify embedded app using React and App Bridge. Everything works fine when the app is accessed through the Shopify Admin. However, when I access the app directly via a live URL like:
I get the following error in the browser console:
Uncaught Error: The shopify global is not defined. This likely means the App Bridge script tag was not added correctly to this page
What I’ve tried:
-
I check for the shop param and redirect to https://shopify.com/login?return_to=… if missing.
-
I delay App Bridge Provider rendering until shop and host exist.
-
The app works when loaded from the Shopify admin.
My goal:
I want to redirect users who access the app URL directly (without a shop param) back to Shopify login or to the embedded app within the Shopify admin.Any ideas on how to fix this? Is there a reliable pattern to prevent this App Bridge error entirely?