Bug report: Shopify fetch override fails to retrieve token

I came across a weird bug when trying to create a new dev app with the shopify app bridge. When trying to hit my backend, the fetch request never completes. The issue seems to be when Shopify’s fetch override tries to retrieve the id token:

n.subscribe("SessionToken.respond", ( ({sessionToken: n}) => {
    t(n)
}

What’s strange is that already existing stores work fine, and don’t seem to have any issues.

Steps to reproduce:

  1. Create a new store in dev portal
  2. Use shopify cli to deploy setup for application_url or whatnot (I was using an existing apps config to ensure that the issue was new)
  3. Load the app in the Shopify admin
  4. Requests to the backend using JS fetch never complete
    1. Stepping through the debugger reveals that they hang at the code snippet above

I’m confident that this has to do with the app bridge fetch override, because disabling it by adding <meta name="shopify-disabled-features" content="fetch" /> to my index.html causes the requests to complete fine (though admittedly without any ID tokens, so this is not a usable workaround)

If relevant, the app handle is: seguno-bulk-daniel-public. We’re loading the App Bridge using Shopify’s CDN

1 Like

Well the Related topics helped me figure it out.

I wasn’t setting the shopify-api-key meta tag in index.html correctly, so it was connecting to the wrong app. That said, it would be nice if this logged an error in some way so that we didn’t spend so much time spinning our wheels–silently failing was unhelpful