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

sample "Angular 17 Standalone MSAL Angular v3 Sample" fails to build: Cannot set properties of null (setting 'parent'), Lifecycle script postinstall:msal-angular failed, etc. #7121

Open
1 of 2 tasks
billvolt opened this issue May 22, 2024 · 0 comments
Labels
adfs Related to ADFS bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@billvolt
Copy link
Contributor

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

14.10.0

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.0.17

Public or Confidential Client?

Public

Description

The instructions accompanying this sample appear result in errors during the build process.

No Fiddler trace is relevant as the build failed.

Error Message

npm notice === Tarball Details ===
npm notice name:          @azure/msal-angular
npm notice version:       3.0.17
npm notice filename:      @azure/msal-angular-3.0.17.tgz
npm notice package size:  82.9 kB
npm notice unpacked size: 351.2 kB
npm notice shasum:        ba75a053cfaee5424c73b00d5615b570e18de4c3
npm notice integrity:     sha512-ROaD9jPMQB40y[...]3xlBDj26vyLOg==
npm notice total files:   52
npm notice
npm ERR! Cannot set properties of null (setting 'parent')

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\myuser.mydomain\AppData\Local\npm-cache\_logs\2024-05-22T19_34_19_270Z-debug-0.log
node:child_process:965
    throw err;
    ^

Error: Command failed: npm i C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\lib\msal-angular\dist\azure-msal-angular-3.0.17.tgz
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at Object.<anonymous> (C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\samples\msal-angular-v3-samples\sample-scripts\useMsalAngularTarball.js:29:1)
    at Module._compile (node:internal/modules/cjs/loader:1364:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
    at Module.load (node:internal/modules/cjs/loader:1203:32)
    at Module._load (node:internal/modules/cjs/loader:1019:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 10572,
  stdout: null,
  stderr: null
}

Node.js v18.20.2
npm ERR! Lifecycle script `postinstall:msal-angular` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: angular17-standalone-sample@0.0.0
npm ERR!   at location: C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\samples\msal-angular-v3-samples\angular17-standalone-sample
npm ERR! Lifecycle script `build` failed with error:
npm ERR! Error: command failed
npm ERR!   in workspace: angular17-standalone-sample@0.0.0
npm ERR!   at location: C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\samples\msal-angular-v3-samples\angular17-standalone-sample



MSAL Logs

MSAL log is not applicable as sample does not run.

Follow log is from C:\Users\myuser.mydomain\AppData\Local\npm-cache_logs\2024-05-22T19_34_19_270Z-debug-0.log:

0 verbose cli C:\Program Files\nodejs\node.exe C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
1 info using npm@8.19.3
2 info using node@v18.20.2
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 info found workspace root at C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js
10 timing config:load:file:C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\.npmrc Completed in 0ms
11 timing config:load:project Completed in 51ms
12 timing config:load:file:C:\Users\myuser.mydomain\.npmrc Completed in 1ms
13 timing config:load:user Completed in 1ms
14 timing config:load:file:C:\Users\myuser.mydomain\AppData\Roaming\npm\etc\npmrc Completed in 0ms
15 timing config:load:global Completed in 0ms
16 timing config:load:validate Completed in 1ms
17 timing config:load:credentials Completed in 1ms
18 timing config:load:setEnvs Completed in 1ms
19 timing config:load Completed in 63ms
20 timing npm:load:configload Completed in 63ms
21 timing npm:load:mkdirpcache Completed in 1ms
22 timing npm:load:mkdirplogs Completed in 1ms
23 verbose title npm i C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\lib\msal-angular\dist\azure-msal-angular-3.0.17.tgz
24 verbose argv "i" "C:\\Users\\myuser.mydomain\\Documents\\GitHub\\microsoft-authentication-library-for-js\\lib\\msal-angular\\dist\\azure-msal-angular-3.0.17.tgz"
25 timing npm:load:setTitle Completed in 1ms
26 timing config:load:flatten Completed in 4ms
27 timing npm:load:display Completed in 6ms
28 verbose logfile logs-max:10 dir:C:\Users\myuser.mydomain\AppData\Local\npm-cache\_logs
29 verbose logfile C:\Users\myuser.mydomain\AppData\Local\npm-cache\_logs\2024-05-22T19_34_19_270Z-debug-0.log
30 timing npm:load:logFile Completed in 5ms
31 timing npm:load:timers Completed in 0ms
32 timing npm:load:configScope Completed in 0ms
33 timing npm:load Completed in 79ms
34 silly logfile start cleaning logs, removing 2 files
35 silly logfile done cleaning log files
36 timing arborist:ctor Completed in 1ms
37 verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: node_modules
38 timing idealTree:init Completed in 13567ms
39 timing idealTree:userRequests Completed in 135ms
40 silly idealTree buildDeps
41 timing idealTree:#root Completed in 1ms
42 silly fetch manifest @azure/msal-angular@file:../../../lib/msal-angular/dist/azure-msal-angular-3.0.17.tgz
43 timing idealTree Completed in 13816ms
44 timing command:i Completed in 13866ms
45 verbose stack TypeError: Cannot set properties of null (setting 'parent')
45 verbose stack     at [nodeFromEdge] (C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1082:17)
45 verbose stack     at async [loadPeerSet] (C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1326:23)
45 verbose stack     at async [buildDepStep] (C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
45 verbose stack     at async Arborist.buildIdealTree (C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:211:7)
45 verbose stack     at async Promise.all (index 1)
45 verbose stack     at async Arborist.reify (C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:154:5)
45 verbose stack     at async Install.exec (C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\lib\commands\install.js:145:5)
45 verbose stack     at async module.exports (C:\Users\myuser.mydomain\AppData\Roaming\npm\node_modules\npm\lib\cli.js:78:5)
46 verbose cwd C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\samples\msal-angular-v3-samples\angular17-standalone-sample
47 verbose Windows_NT 10.0.19045
48 verbose node v18.20.2
49 verbose npm  v8.19.3
50 error Cannot set properties of null (setting 'parent')
51 verbose exit 1
52 timing npm Completed in 14197ms
53 verbose unfinished npm timer reify 1716406459641
54 verbose unfinished npm timer reify:loadTrees 1716406459643
55 verbose unfinished npm timer idealTree:buildDeps 1716406473347
56 verbose unfinished npm timer idealTree:samples/msal-angular-v3-samples/angular17-standalone-sample 1716406473350
57 verbose code 1
58 error A complete log of this run can be found in:
58 error     C:\Users\myuser.mydomain\AppData\Local\npm-cache\_logs\2024-05-22T19_34_19_270Z-debug-0.log

Network Trace (Preferrably Fiddler)

  • Sent
  • Pending

MSAL Configuration

environment.ts:

export const environment = {
  production: false,
  msalConfig: {
      auth: {
          clientId: 'ENTER_CLIENT_ID',
          authority: 'ENTER_AUTHORITY',
          knownAuthorities: [] // array of domains that are known to be trusted
      }
  },
  apiConfig: {
      scopes: ['ENTER_SCOPE'],
      uri: 'ENTER_URI'
  }
};


appconfig.ts:

export function MSALInstanceFactory(): IPublicClientApplication {
  return new PublicClientApplication({
    auth: {
      clientId: environment.msalConfig.auth.clientId,
      authority: environment.msalConfig.auth.authority,
      knownAuthorities: environment.msalConfig.auth.knownAuthorities, // array of domains that are known to be trusted
      redirectUri: '/',
      postLogoutRedirectUri: '/'
    },
    cache: {
      cacheLocation: BrowserCacheLocation.LocalStorage
    },
    system: {
      allowNativeBroker: false, // Disables WAM Broker
      loggerOptions: {
        loggerCallback,
        logLevel: LogLevel.Info,
        piiLoggingEnabled: false
      }
    }
  });
}


environment.dev.ts:

export const environment = {
    production: false,
    msalConfig: {
        auth: {
            clientId: 'e5e38fe1-a478-479e-9d77-5e47626e2af2',  //'ENTER_CLIENT_ID',
            authority: 'https://fs.mydomain.com/adfs/', //'ENTER_AUTHORITY'
            knownAuthorities: ["fs.mydomain.com"] // array of domains that are known to be trusted
        }
    },
    apiConfig: {
        scopes: ['user.read'],
        uri: 'https://graph.microsoft.com/v1.0/me'
    }
};

Relevant Code Snippets

See sample:  https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular17-standalone-sample

Reproduction Steps

  1. Download MSAL from https://github.com/AzureAD/microsoft-authentication-library-for-js to C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js.

  2. Configure sample for ADFS authority and Client ID in environment.ts, environment.dev.ts, and app.config.ts.

  3. Execute command: C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\lib\msal-browser>npm run build:all

  4. Execute command: C:\Users\myuser.mydomain\Documents\GitHub\microsoft-authentication-library-for-js\samples\msal-angular-v3-samples\angular17-standalone-sample\npm run build

Expected Behavior

Sample should complete build without errors.

Identity Provider

ADFS

Browsers Affected (Select all that apply)

Edge

Regression

N/A

Source

External (Customer)

@billvolt billvolt 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 May 22, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label May 22, 2024
@github-actions github-actions bot added adfs Related to ADFS msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adfs Related to ADFS bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package Needs: Attention 👋 Awaiting response from the MSAL.js team public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

1 participant