When loading a private key from file the CLI throws an error when assigning the loaded file to a variable.
box configure:environments:add 107417548__config.json --private-key-path=private.pem
BoxCLIError: Could not read private key file /Users/cbetta/private.pem
Caused by: TypeError: Cannot set property 'privateKey' of undefined
at FoldersGetCommand.getClient (/Users/cbetta/.nvm/versions/node/v14.5.0/lib/node_modules/@box/cli/src/box-command.js:534:35)
at FoldersGetCommand.init (/Users/cbetta/.nvm/versions/node/v14.5.0/lib/node_modules/@box/cli/src/box-command.js:250:22)
at FoldersGetCommand._run (/Users/cbetta/.nvm/versions/node/v14.5.0/lib/node_modules/@box/cli/node_modules/@oclif/command/lib/command.js:28:24)
at Function.Command.run (/Users/cbetta/.nvm/versions/node/v14.5.0/lib/node_modules/@box/cli/node_modules/@oclif/command/lib/command.js:133:16)
at async Config.runCommand (/Users/cbetta/.nvm/versions/node/v14.5.0/lib/node_modules/@box/cli/node_modules/@oclif/config/lib/config.js:151:9)
at async Main.run (/Users/cbetta/.nvm/versions/node/v14.5.0/lib/node_modules/@box/cli/node_modules/@oclif/command/lib/main.js:21:9)
at async Main._run (/Users/cbetta/.nvm/versions/node/v14.5.0/lib/node_modules/@box/cli/node_modules/@oclif/command/lib/command.js:29:20)
It seems the faulty line in question is this line where we assign the loaded file to a value.
https://github.com/box/boxcli/blob/master/src/box-command.js#L534
It seems like we try to assign the loaded file to configObj.appAuth.privateKey where the right syntax should be configObj.boxAppSettings.appAuth.privateKey.
When loading a private key from file the CLI throws an error when assigning the loaded file to a variable.
It seems the faulty line in question is this line where we assign the loaded file to a value.
https://github.com/box/boxcli/blob/master/src/box-command.js#L534
It seems like we try to assign the loaded file to
configObj.appAuth.privateKeywhere the right syntax should beconfigObj.boxAppSettings.appAuth.privateKey.