microsoft-authentication-library-for-js: MSAL Client stopped working after release of msal-common 9.0.2

Core Library

MSAL.js v2 (@azure/msal-browser)

Core Library Version

2.32.1

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

2.5.1

Public or Confidential Client?

Public

Description

We had a working setup, then yesterday when we build a release version on our CI pipeline the released product crashed whenever we tried to login with the PublicClientApplication.

Calling either LoginRedirect or AcquireTokenPopup caused the exception posted below in Error Message.

Nothing in our code base had changed from the solution working to crashing with this.

Workaround is to set reference to @Azure/msal-common 9.0.1 in package.json - then everything seems to work again.

In yesterdays package.json @azure/msal-common was not mentioned, and it seems @Azure/msal.angular usees ^9.0.0 to look up common.

Picking an explicit version seems to fix the problem.

But still 9.0.2 seems broken from where I stand.

Error Message

Error: Uncaught (in promise): TypeError: this.startPerformanceMeasurement is not a function TypeError: this.startPerformanceMeasurement is not a function at o.startMeasurement (PerformanceClient.js:50:1) at t.startMeasurement (BrowserPerformanceClient.js:43:1) at t.<anonymous> (StandardInteractionClient.js:221:1) at d (_tslib.js:87:1) at Object.next (_tslib.js:68:46) at _tslib.js:61:1 at new n (zone.js:1429:1) at to (_tslib.js:57:1) at t.getDiscoveredAuthority (StandardInteractionClient.js:215:16) at t.<anonymous> (StandardInteractionClient.js:155:1) at z (zone.js:1211:1) at zone.js:1118:1 at zone.js:1134:1 at Lve (asyncToGenerator.js:6:1) at s (asyncToGenerator.js:29:1) at k.invoke (zone.js:372:1) at Object.onInvoke (core.mjs:25608:1) at k.invoke (zone.js:371:1) at _.run (zone.js:134:1) at zone.js:1275:1

Msal Logs

No response

MSAL Configuration

{
    auth: {
         clientId: azureAD.clientId,
         authority: "https://login.microsoftonline.com/" + azureAD.tenantId,
    },
    cache: {
         cacheLocation: 'localStorage',
    },
}

LoginRedirect request
{
    authority: "https://login.microsoftonline.com/" + azureAD.tenantId,
    redirectUri: window.location.origin + "/login",
    scopes: ["api://" + azureAD.clientId + "/access"],
    prompt: 'select_aacount
}

Relevant Code Snippets

const azureClient = this.authenticationService.getAzureClient();

await azureClient.handleRedirectPromise();

await azureClient.loginRedirect(this.authenticationService.getAzureRedirectRequest());

 public getAzureClient(): IPublicClientApplication {
        const azureAD = this.authenticationIntegration?.azureAD;
        if (azureAD?.useAzureAD) {
            if (Object.isNullOrUndefined(this._azureClient)) {
                this._azureClient = new PublicClientApplication({
                    auth: {
                        clientId: azureAD.clientId,
                        authority: "https://login.microsoftonline.com/" + azureAD.tenantId,
                    },
                    cache: {
                        cacheLocation: 'localStorage',
                    },
                });
            }
            return this._azureClient;
        } else {
            return undefined;
        }
    }


public getAzureRedirectRequest(): RedirectRequest {
        const azureAD = this.authenticationIntegration.azureAD;
        const prompt = azureAD.attemptAutomaticLogin ? undefined : 'select_account';

        return {
            authority: "https://login.microsoftonline.com/" + azureAD.tenantId,
            redirectUri: window.location.origin + "/login",
            scopes: ["api://" + azureAD.clientId + "/access"],
            prompt: prompt
        }
    }

Reproduction Steps

Build with package json using these three

@azure/msal-browser”: “2.32.1”, “@azure/msal-angular”: “2.5.1”, “@azure/msal-common”: “9.0.1”,

Things are working.

Build with “@azure/msal-browser”: “2.32.1”, “@azure/msal-angular”: “2.5.1”, “@azure/msal-common”: “9.0.2”,

things are broken

Expected Behavior

That you releasing a fix version to msal-common doesn’t break our production build 😉

Identity Provider

Azure AD / MSA

Browsers Affected (Select all that apply)

Chrome, Edge

Regression

@azure/msal-common 9.0.1

Source

External (Customer)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 15

Commits related to this issue

Most upvoted comments

Thank you all for your patience. Msal-common v 9.1.1 has been released. Please upgrade and let us know if you continue to see issues.

I can also confirm that the following package versions work:

    "@azure/msal-browser": "^2.32.2",
    "@azure/msal-common": "^9.1.1",
    "@azure/msal-react": "^1.5.2",

If it helps anyone, I ended up with the following in my package.json:

    "@azure/msal-browser": "2.32.0",
    "@azure/msal-common": "9.0.1",
    "@azure/msal-react": "1.5.0",

Thanks to @ralphtheninja for suggesting I should get rid of the ^

I also updated the npm install command in the Azure Pipeline yaml to be npm install --legacy-peer-deps

@AnkHansen This is a bug with the previous release, and we are currently working on a fix. Please downgrade until the fix is released.

@jo-arroyo 9.1.1 fixes the issue for me

I’ve just hit this problem also, and can confirm that @yassarikhan786 suggested versions work.

Hi @aneeshm-kroger Do not add ^ before version, delete entire node_modules folder, package-lock.json or yarn.lock file and check, Hope it will resolve your issue.

Thanks

Hi all, I’ve tried explicitly adding "@azure/msal-common": "^9.0.1", to my package.json with no success. The difference with my project is that I’m using "@azure/msal-react".

@yassarikhan786 This means you’ll get version 9.0.2 which is what you don’t want. You should pin it to 9.0.1 and not use ^.