Description
Core Library
MSAL Node (@azure/msal-node)
Core Library Version
2.7.0
Wrapper Library
MSAL Node Extensions (@azure/msal-node-extensions)
Wrapper Library Version
1.0.15
Public or Confidential Client?
Public
Description
Node does not shutdown after simply creating a NativeBrokenPlugin
Error Message
None. Node just stays running unless process.exit() is called. I suspect that the NativeBrokerPlugin is listening on a socket and it will continue listening until someone shuts it down. Perhaps offer a way to shutdown the NativeBrokerPlugin when we're done with it.
e.g.
const plugin = new NativeBrokerPlugin()
plugin.dispose()
MSAL Logs
None. Despite trace being turned on
Network Trace (Preferrably Fiddler)
- Sent
- Pending
MSAL Configuration
{
auth: {
clientId: 'clientId',
authority: 'https://login.microsoftonline.com/facac3c4-e2a5-4257-af76-205c8a821ddb/'
},
broker: {
nativeBrokerPlugin: new NativeBrokerPlugin()
},
system: {
loggerOptions: {
logLevel: LogLevel.Trace,
loggerCallback: ( level, message, containsPii ): void => {
if ( containsPii ) {
return;
}
switch ( level ) {
case LogLevel.Error:
console.error( message );
return;
case LogLevel.Info:
console.info( message );
return;
case LogLevel.Verbose:
console.debug( message );
return;
case LogLevel.Warning:
console.warn( message );
return;
default:
console.log( message );
return;
}
}
}
}
}
Relevant Code Snippets
import {
LogLevel,
PublicClientApplication
} from '@azure/msal-node';
import { NativeBrokerPlugin } from '@azure/msal-node-extensions';
/******************************************************************************
* Handlers
******************************************************************************/
process.on( 'unhandledRejection', ( reason, promise ) => {
console.log( 'Unhandled Rejection at:', promise, 'reason:', reason );
} );
process.on( 'exit', ()=>console.log( 'Process exit' ) );
/******************************************************************************
* Top Level - First Program Line
******************************************************************************/
main().then( ()=>{
console.log( 'All done in main' );
} ).catch( console.log );
/******************************************************************************
* Function: main
******************************************************************************/
async function main(): Promise<void> {
const cApplication = new PublicClientApplication(
{
auth: {
clientId: 'clientId',
authority: 'https://login.microsoftonline.com/facac3c4-e2a5-4257-af76-205c8a821ddb/'
},
broker: {
nativeBrokerPlugin: new NativeBrokerPlugin()
},
system: {
loggerOptions: {
logLevel: LogLevel.Trace,
loggerCallback: ( level, message, containsPii ): void => {
if ( containsPii ) {
return;
}
switch ( level ) {
case LogLevel.Error:
console.error( message );
return;
case LogLevel.Info:
console.info( message );
return;
case LogLevel.Verbose:
console.debug( message );
return;
case LogLevel.Warning:
console.warn( message );
return;
default:
console.log( message );
return;
}
}
}
}
}
);
//process.exit();
}
Reproduction Steps
Transpile and run the following typescript.
Node does not exit properly unless the process.exit() call is uncommented
Expected Behavior
I would not expect to have to call process.exit()
Identity Provider
Entra ID (formerly Azure AD) / MSA
Browsers Affected (Select all that apply)
Other
Regression
No response
Source
External (Customer)