createAuth0Client hangs in Chrome when loading for a user who is already logged in. It does not hang if there is no logged in user.
If there is a user logged in, the page should load immediately.
Use the test application in this repository: https://github.com/modeswitch/auth0-test-app
plugins/auth0.js near the bottom (search for FIXME).npm run dev in the top-level directory and navigate in Chrome (Beta) to the URL provided (should be http://localhost:3000).sign out button to make testing easier.createAuth0Client to finish.The problem is not reproducible in Firefox and some earlier versions of Chrome as far as I've checked.
Please provide the following:
auth0-spa-js used: v1.12.1@stevehobbsdev ^
@modeswitch Thanks, I've managed to reproduce this on Chrome Beta (86). It relates to a dependency of ours that allows us to sync operations across tabs.
The weird thing is it works fine on Chrome Canary (88). I'm loathe to take too much action based on evidence found in Beta software where there could be unrelated problems. Looks like there might be a stable release this week, let's review once it's out.
cc: @adamjmcgrath
@stevehobbsdev Could you elaborate a bit? Which dependency and what's the issue? I'm asking because this isn't the first time I've seen this problem.
Hi @modeswitch - I don't think it's an issue with a dependency.
Using Chrome 86 Beta, I can reproduce the issue with just the following html:
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<iframe src="http://example.com/"></iframe>
<script>
document.querySelector('iframe').onload = () => console.log('loaded: ', performance.now());
</script>
</body>
</html>
When I load the page from http://localhost:3000 the page load hangs and the iframe takes ~40 secs to load (which is the same delay I'm seeing from the /authorize iframe that getTokenSilently creates)
I'll see if I can find a chromium bug that refers to this issue.
Looks like this is only an issue with 86.0.4240.68 - I've just run it on the latest Beta that got released on Monday 86.0.4240.75 and it seems to work fine.
I can't see anything in the changelog that might have caused the issue 🤷
@adamjmcgrath I have been encountering this issue even on 86.0.4240.75 ... a 30+ second delay between a page refresh and receiving the token.
Happens on 87.0.4278.0 as well (not sure if that's the latest unstable, i'm on ubuntu and I don't remember if I have to update manually thru apt)
It only seems to occur with refreshes, new tab seems to be fine.
@krisdages We don't think this is related to our SDK. Are you able to reproduce this with the simple case that @adamjmcgrath showed here? https://github.com/auth0/auth0-spa-js/issues/591#issuecomment-703673884
Tried the simple case and it doesn't exhibit the issue.
I am seeing it with createAuth0Client though. I can look a little deeper and see if I can find more details about where exactly that's lagging.
-- Edit --
The SuperTokensLock acquisition appears to be what is hanging -- and if that timeout is ms, it doesn't look likes it's being respected.
await lock.acquireLock(GET_TOKEN_SILENTLY_LOCK_KEY, 5000);
@krisdages I initially thought it was browser-tabs-lock too but it doesn't seem to be.
Are you still having issues with this with the latest beta? We've been unable to reproduce this so far since 86.0.4240.75.
With that particular version of 86 I was still having it, but after upgrading to 87.0.4280.27 it seems to be resolved.