Shopify App Bridge not working in react app

Shopify App Bridge not working in react app

Mayank
Shopify Partner
2 0 1

I have created a react app for shopify admin and want to use shopify's style system. For that I have installed the latest versions of "@shopify/polaris" and "@Shopify/app-bridge-react" and followed the steps provided for setup. The polaris library is working fine but app-bridge is giving me problems.

For app bridge setup:

1. I have installed 

"@shopify/app-bridge-react": "^4.1.3"

2. Added this script in the head of my index.html:

<meta name="shopify-api-key" content="%SHOPIFY_API_KEY%" />
<script src="https://cdn.shopify.com/shopifycloud/app-bridge.js"></script>
 
But when I import and use anything from @Shopify/app-bridge-react it doesn't work and gives me this error:
Uncaught Error: App Bridge Next: missing required configuration fields: shop
    at app-bridge.js:1:44135
    at app-bridge.js:1:44212
    at app-bridge.js:1:44242
    at app-bridge.js:1:53002
    at app-bridge.js:1:60155

Can anyone please help me resolve this issue ?

Reply 1 (1)

junejuly1
Shopify Partner
2 0 0

Same here, using vite