Closed galmis closed 1 year ago
Seeing the same issue. @shopify/app-bridge-utils@3.5.0
but also initially tested with version 3.2.6
. Can't replicate the problem when optimized mobile loading is turned off.
Edit: this seems to be happening regardless if optimized mobile loading is on or off – eventually calling await getSessionToken(app)
fails to resolve or throw.
I'd appreciate if we can escalate the severity of this. Most consumers of the API will await
the token before making an API call. Doing that will completely freeze the app for the end user and the app developers will be the ones to get the blame from the merchants.
@janklimo @galmis can I know what version of Shopify Mobile you are using?
I believe that the issue has been fixed in the latest version of Shopify Mobile 9.94.0. Feel free to reopen if necessary. Thanks for reporting this issue 🙇
Describe the bug
When optimized mobile loading is enabled,
getSessionToken
does not resolve if called at the end of token's life cycle (unless thegetSessionToken
function is called again when the token is available).The issue affects the
authenticatedFetch
utility function, which I'm assuming, is relying on thegetSessionToken
under the hood.To Reproduce
Steps to reproduce the behaviour:
getSessionToken
at the end of token's life cycle (e.g. ~50+ seconds after it was issued). The following snippet and the attached console log highlight the issue.Expected behaviour
Ideally,
getSessionToken
should always resolve with a session token. At the very least, I'd expectgetSessionToken
to throw an error if the token can't be issued.Contextual information
Packages and versions
@shopify/app-bridge-utils
@3.5.0
Platform
Additional context
Next.js embedded app created with Shopify cli 2.
The issue isn't reproducible when the optimized mobile loading is disabled. I've mainly tested this on Android 11 but noticed the same side effects on iOS 16.1.1. I couldn't reproduce it on iPad 15.1, though.