Skip to content

Bug report: cmd : m365 aad user list : unhandled exception when using unknown flags #3059

@arjunumenon

Description

@arjunumenon

Description

When you use an unknown flag with m365 aad user list, it leads to an unhandled exception.

Steps to reproduce

  • Execute command m365 aad user list --unknownFlag
  • Getting the following error message
    (node:6072) UnhandledPromiseRejectionWarning: TypeError: options[key].replace is not a function at C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:47:64 at Array.forEach (<anonymous>) at AadUserListCommand.getFilter (C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:45:30) at AadUserListCommand.commandAction (C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:24:29) at C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\Command.js:80:18 at processTicksAndRejections (internal/process/task_queues.js:93:5) (Use node --trace-warnings ...to show where the warning was created) (node:6072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:6072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected results

Error: Please specify value for option unknownFlag

Actual results

Getting following error message

(node:6072) UnhandledPromiseRejectionWarning: TypeError: options[key].replace is not a function at C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:47:64 at Array.forEach (<anonymous>) at AadUserListCommand.getFilter (C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:45:30) at AadUserListCommand.commandAction (C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:24:29) at C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\Command.js:80:18 at processTicksAndRejections (internal/process/task_queues.js:93:5) (Use node --trace-warnings ...to show where the warning was created) (node:6072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:6072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Diagnostics

Executing command aad user list with options {"options":{"invalidParam":12,"debug":true,"output":"text"}} (node:2944) UnhandledPromiseRejectionWarning: TypeError: options[key].replace is not a function at C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:47:64 at Array.forEach (<anonymous>) at AadUserListCommand.getFilter (C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:45:30) at AadUserListCommand.commandAction (C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\m365\aad\commands\user\user-list.js:24:29) at C:\Users\USERNAME\AppData\Roaming\nvm\v14.15.0\node_modules\@pnp\cli-microsoft365\dist\Command.js:80:18 at processTicksAndRejections (internal/process/task_queues.js:93:5) (Usenode --trace-warnings ...to show where the warning was created) (node:2944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:2944) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

CLI for Microsoft 365 version

v4.4.0

nodejs version

14.15.0

Operating system (environment)

Windows

Shell

Other

cli doctor

authMode : DeviceCode
cliAadAppId : 31359c7f-bd7e-475c-86db-fdb8c937548e
cliAadAppTenant: common
cliConfig : {"output":"text","showHelpOnFailure":false}
cliEnvironment :
cliVersion : 4.4.0
nodeVersion : v14.15.0
os : {"platform":"win32","version":"Windows 10 Enterprise","release":"10.0.19042"}
roles : []
scopes : ["AllSites.FullControl","AppCatalog.ReadWrite.All","ChannelMember.ReadWrite.All","Chan
nelMessage.Read.All","ChannelMessage.Send","ChannelSettings.ReadWrite.All","Chat.Read","Directory.Acces
sAsUser.All","Directory.ReadWrite.All","Group.ReadWrite.All","IdentityProvider.ReadWrite.All","Mail.Rea
dWrite","Mail.Send","Policy.Read.All","Reports.Read.All","ServiceMessage.Read.All","Tasks.ReadWrite","T
eam.Create","TeamMember.ReadWrite.All","TeamsApp.ReadWrite.All","TeamsAppInstallation.ReadWriteForUser"
,"TeamSettings.ReadWrite.All","TeamsTab.ReadWrite.All","TermStore.ReadWrite.All","User.Invite.All","Use
r.ReadWrite.All","profile","openid","email"]

Additional Info

N/A

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions