You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we change the version of oidc-client and oidc-client-service-worker in local development between runs sometimes the app can't be loaded properly again.
App is reloaded couple of times, sometimes infinitely.
It seems that service worker for some reason is not activated properly on downgraded/upgraded version.
It is triggered inside initWorkerAsync.ts.
When if(serviceWorkerVersion !== codeVersion) the console log about unregistering and reloading is prompted.
Then the service_worker_update_require_callback kicks in with default reload of page.
It happens in my personal react app where I try similar steps but also for AxaFrance/oidc-client.git demo app with below steps.
Sometimes the index.js:255 Service worker 7.22.9 version mismatch with js client version 7.22.8, unregistering and reloading happens once, sometimes twice, sometimes multiple times (together with reloading, unregistering and registering service worker again - basically whole process).
clone and install git clone https://github.com/AxaFrance/oidc-client.git,
uncomment service worker mode (both service_worker_relative_url: '/OidcServiceWorker.js', in examples/react-oidc-demo/src/configurations.ts),
run the react app locally with pnpm start,
close dev server,
change oidc versions in packages/oidc-client/src/version.ts and packages/oidc-client-service-worker/src/version.ts to some lower version (in my case to 7.22.8 ,
install packages again,
run the dev server again,
see the console
When the problem with more than one reload occurs the console logs seem to follow the pattern:
> Service worker 7.22.9 version mismatch with js client version 7.22.8, unregistering and reloading
> [OidcServiceWorker] service worker installed 1720185015
> TypeError: Failed to fetch
at me ()
at r ()
at Object.startKeepAliveServiceWorker ()
at mn ()
> [vite] connecting...
> [vite] connected.
> Service worker 7.22.9 version mismatch with js client version 7.22.8, unregistering and reloading
... looped again
Versions
Tried with 7.22.9 -> 7.22.8 -> 7.22.9
as well as with 7.22.9 -> 7.22.7 -> 7.22.9
Browser: chrome latest (haven't tested on other browsers),
Screenshots
Axa fr demo react app single reload (proper(?) behavior):
Axa fr demo react app double reload (probably improper behavior with service worker not being registerer properly for the first time):
Axa fr demo react app infinite reload:
My app with more than one reload but finally opening properly after 7th time (sometimes it's one time, sometimes infinite):
Expected
Service worker is properly unregistered and registered in one try when version of packages changes between opening dev server locally after reinstalling packages.
Actual
Sometimes whole process gets in a loop and try to register the service worker multiple times
Additional Details
actually it's hard to reproduce - tried multiple times to get the infinite loop but nonetheless the issue occurs sometmes,
in chrome://serviceworker-internals/ it is possible to see the service worker for localhost being removed and added again when the loop happens,
spotted only on local env. Not visible on any deployed site,
for my personal app the step with adding proper service worker in postinstall step is applied (thought it may be the reason for the loops at the beginning)
Installed packages:
for demo axa app as in the repo,
for my personal app "@axa-fr/oidc-client": "7.22.9",
The text was updated successfully, but these errors were encountered:
Hi @piotrbartnik , thank yoi for your issue.
I had this behavior today upgrading my current application and it is a very important problem to resolve. I think i will try a more agressive unregistration.
Issue and Steps to Reproduce
When we change the version of
oidc-client
andoidc-client-service-worker
in local development between runs sometimes the app can't be loaded properly again.App is reloaded couple of times, sometimes infinitely.
It seems that service worker for some reason is not activated properly on downgraded/upgraded version.
It is triggered inside
initWorkerAsync.ts
.When
if(serviceWorkerVersion !== codeVersion)
the console log about unregistering and reloading is prompted.Then the
service_worker_update_require_callback
kicks in with default reload of page.It happens in my personal react app where I try similar steps but also for
AxaFrance/oidc-client.git
demo app with below steps.Sometimes the
index.js:255 Service worker 7.22.9 version mismatch with js client version 7.22.8, unregistering and reloading
happens once, sometimes twice, sometimes multiple times (together with reloading, unregistering and registering service worker again - basically whole process).git clone https://github.com/AxaFrance/oidc-client.git
,service_worker_relative_url: '/OidcServiceWorker.js',
inexamples/react-oidc-demo/src/configurations.ts
),pnpm start
,packages/oidc-client/src/version.ts
andpackages/oidc-client-service-worker/src/version.ts
to some lower version (in my case to7.22.8
,When the problem with more than one reload occurs the console logs seem to follow the pattern:
Versions
Tried with 7.22.9 -> 7.22.8 -> 7.22.9
as well as with 7.22.9 -> 7.22.7 -> 7.22.9
Browser: chrome latest (haven't tested on other browsers),
Screenshots
Axa fr demo react app single reload (proper(?) behavior):
Axa fr demo react app double reload (probably improper behavior with service worker not being registerer properly for the first time):
Axa fr demo react app infinite reload:
My app with more than one reload but finally opening properly after 7th time (sometimes it's one time, sometimes infinite):
Expected
Service worker is properly unregistered and registered in one try when version of packages changes between opening dev server locally after reinstalling packages.
Actual
Sometimes whole process gets in a loop and try to register the service worker multiple times
Additional Details
for demo axa app as in the repo,
for my personal app
"@axa-fr/oidc-client": "7.22.9",
The text was updated successfully, but these errors were encountered: