Rails app does not load in Admin.Shopify.Com

358 Views Asked by At

I created a Rails shopify app using the Shopify library https://github.com/Shopify/shopify_app . The App works perfect if I access it through foo.myshopify.com/admin/apps/foo but fails to load in the admin.shopify.com with the following error below

enter image description here

From this, it seems like it is a known issue https://github.com/Shopify/shopify-app-bridge/issues/160 . Is there a fix for this and how do I fix it when I used the Shopify app library https://github.com/Shopify/shopify_app ?

1

There are 1 best solutions below

1
On

Yes, the linked article gives 3 requirements that must be met:

...we have consolidated Shopify’s admin domains under a single domain: admin.shopify.com. This change reduces page reloads when you navigate the Shopify admin. You will notice this new domain and unique store extension in place of the usual myshopify.com URL. This will only change the URL that a merchant uses to access their store admin-it will not have any impact on the URLs in the APIs.

For embedded apps to work correctly on the new admin domain, ensure:

1 The content security policy includes admin.shopify.com.

2 The app is on App Bridge 2.0 or higher. We recommend upgrading to App Bridge 3.0.

3 The app has correctly implemented the host parameter. For the theme editor to work correctly within the new admin domain, ensure that your themes do not reach outside the frame (for example: referencing window.top). Instead, follow this documentation to be able to detect the theme editor.

So, check your content security policy, ensure you are using App Bridge 3.0 and check your host parameter

Based upon your issue, my guess is you have the old host parameter, which is why the old link works, but not the new link:

To ensure that you're configuring App Bridge correctly, you must always use the host that's provided by Shopify.

Shopify is consolidating its admin domains. During the rollout period, the store loading your app might use the old myshopify.com domain, or the new admin.shopify.com domain. This impacts the value returned in the host parameter. to The host parameter value can also differ depending on whether your app runs in web, mobile, or POS.

If you initialize App Bridge with an incorrect host, then your app won't work as expected.