getSessionToken(app) does not resolve with the new admin domain url experience

Solved

getSessionToken(app) does not resolve with the new admin domain url experience

zmbnski
Shopify Partner
4 1 1

Hi,

 

Using the new admin domain url my apps does not load (stops) on resolving the function getSessionToken(app). This is what I do:

 

 

async function retrieveToken(app) {
  window.sessionToken = await getSessionToken(app)
}

window.app = createApp({
    apiKey: api,
    shopOrigin: shopOrigin,
    forceRedirect: true,
    host: host,
})

await retrieveToken(app)

 

 

It only does not resolve on the new url. On the old one it works fine.

 

Anybody had similar problem? Or maybe knows what can be the solution?

Accepted Solution (1)
zmbnski
Shopify Partner
4 1 1

This is an accepted solution.

I finally managed to fix this. We needed to update the app bridge package to 2.x version. This github issue helped https://github.com/Shopify/shopify-app-bridge/issues/110#issuecomment-1142210123

View solution in original post

Replies 4 (4)

Alan
Shopify Staff
129 15 25

Hey @zmbnski - thanks for reaching out. This is for sure odd behaviour, from what I can see your code snippet is correct, so no worries on that end of things. One thing I've noticed that can frequently cause similar behaviour like the this unresolving function is that a different domain than the one you supplied in Partners Dashboard (under 'App Setup') is being used to load the app. 

 

At the moment, it's not possible to use multiple domains or subdomains when using the getSessionToken function. My understanding is that App Bridge will only accept messages from the domain specified in your Partners Dashboard.

 

I also know that errors like this one can sometimes be related to the app itself not being installed on the relevant store or if the store you've instantiated with App Bridge is incorrect. There's another thread from one of my colleagues that goes into a bit more detail here and could help with troubleshooting this further.

 

Hope this helps - let me know if you're still encountering this after taking a look at some of the things I mentioned above/in that other thread. Happy to keep looking into this if need be, definitely an odd error for sure.

 

Cheers!

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

zmbnski
Shopify Partner
4 1 1

Hi,

 

Thanks for your response. The url I'm providing in the partners dashboard is the same as the url that serves the app. As I said: the apps loads normally on the old admin domain <store>.myshopify.com/admin..., but does not load on the new domain admin.shopify.com/store/...

 

The only difference is that here I'm trying to load the app on the new domain. Everything else is the same.

 

If this can have any significance, I installled the app using the old domain, so maybe now app bridge somehow can't resolve GetSessionToken using the new domain? But I can't really check it, because if I try to reinstall my development app, I need to use 'Test on development store' option in Partners Dashboard that uses the old domain... And anyway this would be a problem for any merchant that installed the app on old domain and would try to use it on the new.

 

It would be nice to have any feedback from GetSessionToken function, but as I said it doesn't return anything, just freezes. Would appreciate any help with this.

Alan
Shopify Staff
129 15 25

Hey @zmbnski , thanks for reaching out again- it is definitely possible that the app using the old domain but still referencing the new domain has impacted how your access to feedback through the GetSessionToken import function works. I'm not a developer myself, and my team's scope is only within troubleshooting various aspects of our API specifically, but I was able to do a bit of digging and found a GitHub issue available publicly that might give you s...

 

You could also try to open a GitHub issue directly to see if you're able to get support with this as it does seem like an odd situation. I can't guarantee anything on my end - but it can sometimes help to open an issue on the public Shopify GitHub for situations like these. 

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

zmbnski
Shopify Partner
4 1 1

This is an accepted solution.

I finally managed to fix this. We needed to update the app bridge package to 2.x version. This github issue helped https://github.com/Shopify/shopify-app-bridge/issues/110#issuecomment-1142210123