oidc-client icon indicating copy to clipboard operation
oidc-client copied to clipboard

Service worker keep alive failed to fetch logs

Open beanovar opened this issue 2 years ago • 5 comments

Hi,

Is it possible please to remove the following console.logs and just swallow / ignore it silently instead? https://github.com/AxaGuilDEv/react-oidc/blob/3ec7132a7810a5276b0fc8eaffe1573523fd5534/packages/react/src/oidc/vanilla/initWorker.ts#L44

https://github.com/AxaGuilDEv/react-oidc/blob/3ec7132a7810a5276b0fc8eaffe1573523fd5534/packages/react/src/oidc/vanilla/initWorker.ts#L46

They cause a lot of noise ! :(

Thanks

beanovar avatar Oct 26 '22 08:10 beanovar

Or this could be behind a flag...

ronildo avatar Oct 26 '22 12:10 ronildo

hi @beanovar and @ronildo,

yearh, I'am agree : A flag would be a good solution. The issue is discussed also here #862. I have a problem, chrome is loggin an error even if we do not set up log. I will be on holiday for 2 weeks. May you wait a little for it ?

Thank you for your issue @beanovar .

guillaume-chervet avatar Oct 26 '22 14:10 guillaume-chervet

Hi @ronildo , @beanovar , in the lastest chrome and edge version, i do not have this problem anymore. I do not know why, i think they have made an update on chromiom side.

guillaume-chervet avatar Feb 05 '23 06:02 guillaume-chervet

I had similar issues with log errors "failed to fetch /OidcKeepAliveServiceWorker.json"

Inside the serviceWorker, I noticed the hanleFetch function was responding to the event via keepAliveAsync however keepAliveAsync was not being awaited. Once awaited was added, the fetch error was resolved. Unsure if this is best practice, but it did silence the error logs.

const handleFetch = async (event) => {
    const originalRequest = event.request;
    const url = originalRequest.url;
    if (originalRequest.url.includes(keepAliveJsonFilename)) {
        event.respondWith(await keepAliveAsync(event)); // 👈 await added here
        return;
    }
    // .....
}

@axa-fr/react-oidc package version 6.14.10

bkershaw avatar Feb 28 '23 21:02 bkershaw

Hi @guillaume-chervet @bkershaw We currently have a similar issue (I tried using different browsers), when I do "Empty Cache and Hard Reload" so:

  • It ends up with 404 locally
  • Retrieves index.html while running in Azure (behind NGINX and Docker)
  • Works as expected if I just refresh the page without hard reload afterwards

It really seems that "OidcKeepAliveServiceWorker.json" request isn't handled by the library upon hard refresh Is there anything that could potentially help us?

Zamaletdinov avatar Mar 07 '23 09:03 Zamaletdinov