okta-samples/okta-vue-sample

Uncaught exception thrown when redirect happens after okta sign in

Closed this issue · 4 comments

This library throws an uncaught exception when the browser is redirected after successful log in in okta. This is affecting the okta-vuejs library and won't allow you gracefully handle the exception.

native.js?b7d0:26 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'BroadcastChannel': Channel is closed
at Object.postMessage (webpack-internal:///./node_modules/broadcast-channel/dist/esbrowser/methods/native.js:44:21)
at eval (webpack-internal:///./node_modules/broadcast-channel/dist/esbrowser/broadcast-channel.js:244:47)
postMessage @ native.js?b7d0:26
eval @ broadcast-channel.js?e27c:198
Promise.then (async)
eval @ broadcast-channel.js?e27c:202
Promise.then (async)
_post @ broadcast-channel.js?e27c:197
postInternal @ broadcast-channel.js?e27c:112
_sendMessage @ leader-election.js?a603:311
eval @ leader-election.js?a603:158
Promise.then (async)
applyRun @ leader-election.js?a603:151
eval @ leader-election.js?a603:183
Promise.then (async)
applyOnce @ leader-election.js?a603:182
eval @ leader-election.js?a603:252
_awaitLeadershipOnce @ leader-election.js?a603:238
awaitLeadership @ leader-election.js?a603:195
startElector @ ServiceManager.ts?5a65:141
start @ ServiceManager.ts?5a65:100
start @ OktaAuth.ts?f435:366
created @ okta-vue.ts?3973:127
callWithErrorHandling @ runtime-core.esm-bundler.js?d2dd:155
callWithAsyncErrorHandling @ runtime-core.esm-bundler.js?d2dd:164
callHook @ runtime-core.esm-bundler.js?d2dd:2983
applyOptions @ runtime-core.esm-bundler.js?d2dd:2885
finishComponentSetup @ runtime-core.esm-bundler.js?d2dd:7230
setupStatefulComponent @ runtime-core.esm-bundler.js?d2dd:7142
setupComponent @ runtime-core.esm-bundler.js?d2dd:7063
mountComponent @ runtime-core.esm-bundler.js?d2dd:4951
processComponent @ runtime-core.esm-bundler.js?d2dd:4926
patch @ runtime-core.esm-bundler.js?d2dd:4518
componentUpdateFn @ runtime-core.esm-bundler.js?d2dd:5136
run @ reactivity.esm-bundler.js?89dc:185
callWithErrorHandling @ runtime-core.esm-bundler.js?d2dd:155
flushJobs @ runtime-core.esm-bundler.js?d2dd:394
Promise.then (async)
queueFlush @ runtime-core.esm-bundler.js?d2dd:285
queueJob @ runtime-core.esm-bundler.js?d2dd:279
eval @ runtime-core.esm-bundler.js?d2dd:5168
triggerEffects @ reactivity.esm-bundler.js?89dc:382
triggerRefValue @ reactivity.esm-bundler.js?89dc:982
eval @ reactivity.esm-bundler.js?89dc:1113
triggerEffects @ reactivity.esm-bundler.js?89dc:382
triggerRefValue @ reactivity.esm-bundler.js?89dc:982
eval @ reactivity.esm-bundler.js?89dc:1113
triggerEffects @ reactivity.esm-bundler.js?89dc:382
triggerRefValue @ reactivity.esm-bundler.js?89dc:982
eval @ reactivity.esm-bundler.js?89dc:1113
triggerEffects @ reactivity.esm-bundler.js?89dc:382
triggerRefValue @ reactivity.esm-bundler.js?89dc:982
eval @ reactivity.esm-bundler.js?89dc:1113
triggerEffects @ reactivity.esm-bundler.js?89dc:382
triggerRefValue @ reactivity.esm-bundler.js?89dc:982
set @ reactivity.esm-bundler.js?89dc:1026
finalizeNavigation @ vue-router.esm-bundler.js?ec2d:3194
eval @ vue-router.esm-bundler.js?ec2d:3067
Promise.then (async)
pushWithRedirect @ vue-router.esm-bundler.js?ec2d:3031
push @ vue-router.esm-bundler.js?ec2d:2966
navigate @ vue-router.esm-bundler.js?ec2d:2093
callWithErrorHandling @ runtime-core.esm-bundler.js?d2dd:155
callWithAsyncErrorHandling @ runtime-core.esm-bundler.js?d2dd:164
invoker @ runtime-dom.esm-bundler.js?2725:369

The same issue is observed while running the sample project https://github.com/okta-samples/okta-vue-sample.

Downgrading okta-auth-js version to 6.2.0 did take care of the error.

Thanks for the heads up @gmoitra. I've seen this issue as well and entered an issue for it at okta/okta-auth-js#1174. It seems to affect Angular, React, and Vue SDKs. Downgrading to Auth JS 6.2.0 is my recommended workaround.

I've downgraded this sample so it works without errors. Thanks for the motivation!

Thank you for creating this sample example to easily understand the okta redirect authentication model.