Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSAL Client stopped working after release of msal-common 9.0.2 #5569

Closed
AnkHansen opened this issue Jan 13, 2023 · 15 comments
Closed

MSAL Client stopped working after release of msal-common 9.0.2 #5569

AnkHansen opened this issue Jan 13, 2023 · 15 comments
Assignees
Labels
bug A problem that needs to be fixed for the feature to function as intended. msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications

Comments

@AnkHansen
Copy link

AnkHansen commented Jan 13, 2023

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. (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. (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)

@AnkHansen AnkHansen added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Jan 13, 2023
@ghost ghost added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Jan 13, 2023
@github-actions github-actions bot added msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Jan 13, 2023
@ghost ghost assigned hectormmg Jan 13, 2023
@hectormmg hectormmg assigned jo-arroyo and unassigned hectormmg Jan 17, 2023
@jo-arroyo jo-arroyo added bug A problem that needs to be fixed for the feature to function as intended. and removed question Customer is asking for a clarification, use case or information. msal-angular Related to @azure/msal-angular package bug-unconfirmed A reported bug that needs to be investigated and confirmed labels Jan 17, 2023
@ghost ghost removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label Jan 17, 2023
@jo-arroyo
Copy link
Collaborator

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

@yassarikhan786
Copy link

yassarikhan786 commented Jan 18, 2023

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".

I've tried downgrading the version of msal-react with no success. Any suggestions would be welcome. My setup is as follows:

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

@ralphtheninja
Copy link

ralphtheninja commented Jan 18, 2023

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 ^.

@yassarikhan786
Copy link

Hi @ralphtheninja thank you for that. I've tried that and unfortunately it doesn't work. It works locally and fails when deployed. I'm deploying to an azure website. Build and Release pipelines are fine.

@yassarikhan786
Copy link

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

@aneeshm-kroger
Copy link

Hi I am using react and i have this setup:
"@azure/msal-browser": "^2.31.0",
"@azure/msal-react": "^1.5.0",
I am getting below error , please help me out about this :
PerformanceClient.ts:123 Uncaught (in promise) TypeError: a.startMeasurement is not a function
at e.startMeasurement (PerformanceClient.ts:123:32)
at t.startMeasurement (BrowserPerformanceClient.ts:46:55)
at t. (StandardInteractionClient.ts:205:65)
at Navbar.js:82:11
at Object.next (Navbar.js:82:11)
at Navbar.js:82:11
at new Promise ()
at _l (Navbar.js:82:11)
at t.getDiscoveredAuthority (StandardInteractionClient.ts:203:71)
at t. (StandardInteractionClient.ts:142:48)
Screenshot 2023-01-19 at 8 00 26 AM

@heerparmar
Copy link

heerparmar commented Jan 19, 2023

Same issue we are facing in live, local it's working,

Try to update version as below, It is working for us.

 "@azure/msal-browser": "2.30.0",    
 "@azure/msal-common": "7.6.0",
 "@azure/msal-react": "1.4.5"

Thanks

@aneeshm-kroger
Copy link

Now I am using this one still I am getting same error:
"@azure/msal-browser": "^2.30.0",
"@azure/msal-common": "^7.6.0",
"@azure/msal-react": "^1.4.5"
Error:
PerformanceClient.ts:123 Uncaught (in promise) TypeError: a.startMeasurement is not a function
at e.startMeasurement (PerformanceClient.ts:123:32)
at t.startMeasurement (BrowserPerformanceClient.ts:46:55)
at t. (StandardInteractionClient.ts:205:65)
at Navbar.js:82:11
at Object.next (Navbar.js:82:11)
at Navbar.js:82:11
at new Promise ()
at _l (Navbar.js:82:11)
at t.getDiscoveredAuthority (StandardInteractionClient.ts:203:71)
at t. (StandardInteractionClient.ts:142:48)

@heerparmar
Copy link

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

@aneeshm-kroger
Copy link

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

Many many Thanks Its working for me

@dlgoodchild
Copy link

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

@jo-arroyo
Copy link
Collaborator

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.

@davidspiess
Copy link

@jo-arroyo 9.1.1 fixes the issue for me

@dlgoodchild
Copy link

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",

@jo-arroyo
Copy link
Collaborator

Thank you for the confirmation. Closing as msal-common v9.1.1 release addresses these issues. Please open a new issue if you continue to see errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A problem that needs to be fixed for the feature to function as intended. msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications
Projects
None yet
Development

No branches or pull requests

9 participants