Cli-microsoft365: Bug report: Adding --pretty to "aad user list" results in an unhandled exception

Created on 4 May 2020  路  4Comments  路  Source: pnp/cli-microsoft365

Description

Adding --pretty to "aad user list" results in an unhandled exception.
Office 365 CLI version: 2.10.0-beta.9e086a8

o365$ aad user list -o json --pretty
(node:298) UnhandledPromiseRejectionWarning: TypeError: options[key].replace is not a function
    at Object.keys.forEach.key (/home/azuser/.npm-global/lib/node_modules/@pnp/office365-cli/dist/o365/aad/commands/user/user-list.js:47:64)
    at Array.forEach (<anonymous>)
    at AadUserListCommand.getFilter (/home/azuser/.npm-global/lib/node_modules/@pnp/office365-cli/dist/o365/aad/commands/user/user-list.js:45:30)
    at AadUserListCommand.commandAction (/home/azuser/.npm-global/lib/node_modules/@pnp/office365-cli/dist/o365/aad/commands/user/user-list.js:25:29)
    at Auth_1.default.restoreAuth.then (/home/azuser/.npm-global/lib/node_modules/@pnp/office365-cli/dist/Command.js:61:21)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:298) 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(). (rejection id: 1)
(node:298) [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.
bug work in progress

Most helpful comment

We have just released a new preview versions that has this issue fixed. Once again, thank you for bringing it to our attention 馃憤

All 4 comments

Thank you for reporting this @alexandair and apologies for the trouble.

I've been able to recreate this in both immersive and non-immersive mode, we will take a look ASAP.

This issue was caused by the global pretty option not being included in an array called excludeOptions in the getFilters() implementation.

Having looked at a few other commands that contain similar implementations, this issue could be more widespread than just this one command, however from what I can see, aad user list is the only command that is used to return data, the other commands are either add or set commands and so the --pretty option is unlikely to be used with these commands.

@garrytrinder Excellent idea. I thought that issue might be present in some other commands.

We have just released a new preview versions that has this issue fixed. Once again, thank you for bringing it to our attention 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OodapowUiPath picture OodapowUiPath  路  3Comments

waldekmastykarz picture waldekmastykarz  路  3Comments

waldekmastykarz picture waldekmastykarz  路  3Comments

rabwill picture rabwill  路  3Comments

garrytrinder picture garrytrinder  路  3Comments