Skip to content

identityProxy reference is lost in appAuthServiceWorker.js even with keepAlive message #53

@MichaelRedfernAu

Description

@MichaelRedfernAu

Hi Jake,

We have implemented appAuthHelper and OIDC session check and all is mostly working well, however, we observe random instances of the service worker failing to intercept fetch requests.

We are tracking requests to our APIs where the authorization header / bearer token is missing and this is running at around 3% failure rate.

Our theory is the service worker is being terminated even with the keepAlive messages.

I have seen this via a screen share and I can replicate this by stopping the service worker under Chrome.
image

Now identityProxy is undefined.
image

if (self.identityProxy) {

You have code to check if the worker is alive and re-register it here, but the re-registration never fires as savedReg is still active.

if (savedReg && savedReg.active) {
// prevents the service worker thread from becoming idle and losing
// the references we just passed into it.
savedReg.active.postMessage({"message": "keepAlive"});
} else {
// In case the service worker still somehow manages to become inactive,
// re-registers it.
registerServiceWorker().catch((function () {

One thought I had was the keepAlive message could post the appAuthConfig in each time and instantiate a new IdentityProxyServiceWorker if identityProxy is undefined.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions