Questions and discussions about using the Shopify CLI and Shopify-built libraries.
When a user clicks on our app, it tries to load in an iframe but is then escaped (unintentionally) to a non-embedded screen.
Below is the code that is running right before escaping the iframe.
this.shopifyApp = createApp({ apiKey: 'my api key', host: 'host from shopify' }) Redirect.create(this.shopifyApp).dispatch(Redirect.Action.REMOTE, permissionUrl)
It appears that the Shopify code is erroring with this particular error...
A network failure may have prevented the request from completing
Also, there are a bunch of the following errors...
https://monorail-edge.shopifysvc.com/v1/produce net::ERR_BLOCKED_BY_CLIENT
Hi SnailBlast!
Sorry to hear about your redirection issues. Could you confirm which version of app-bridge you're running?
To my mind this seems like an issue with Oauth. If you're trying to build an embedded app, you need to first check `isShopifyEmbedded()` before redirecting. There's more info here: https://shopify.dev/apps/tools/app-bridge/getting-started/app-setup#authorize-with-oauth
Let us know if this helps!
- M
To learn more visit the Shopify Help Center or the Community Blog.
Here are the App Bridge versions I am using...
"@shopify/app-bridge": "^3.2.6",
"@shopify/app-bridge-utils": "^3.2.6",
if (isShopifyEmbedded()) {
this.shopifyApp = createApp({
apiKey: this.$config.shopifyApiKey,
host: this.$route.query.host
})
//fails here and redirects
Redirect.create(this.shopifyApp).dispatch(Redirect.Action.REMOTE, permissionUrl)
// Otherwise, redirect using the `window` object
} else {
window.location.assign(permissionUrl)
}
OK, a couple of questions for you:
host
parameter is only guaranteed on initial load of your app." Can you try storing the host in a variable before your call to createApp
, and then checking to ensure it is actually available before proceeding?Looking forward to your answers.
To learn more visit the Shopify Help Center or the Community Blog.
Below are my answers:
The error messages you are getting are due to you using an ad blocker. However, even if you disable it, your main problem will be persist just like before. I am getting the same problem.