Can't get environments list from cli

Hello, i want to use forest-cli for my CI/CD setup but getting errors while running forest environments:list

Expected behavior

Get environments list.

Actual behavior

Getting js error trace.

Failure Logs

forest environments:list
TypeError: Cannot read property 'toString' of null
    at /usr/local/lib/node_modules/forest-cli/node_modules/cli-table/lib/index.js:182:27
    at Array.forEach (<anonymous>)
    at generateRow (/usr/local/lib/node_modules/forest-cli/node_modules/cli-table/lib/index.js:181:11)
    at /usr/local/lib/node_modules/forest-cli/node_modules/cli-table/lib/index.js:275:16
    at Table.forEach (<anonymous>)
    at Table.toString (/usr/local/lib/node_modules/forest-cli/node_modules/cli-table/lib/index.js:258:10)
    at EnvironmentsRenderer.render (/usr/local/lib/node_modules/forest-cli/src/renderers/environments.js:38:20)
    at EnvironmentCommand.runIfAuthenticated (/usr/local/lib/node_modules/forest-cli/src/commands/environments.js:19:31)
    at async (/usr/local/lib/node_modules/forest-cli/src/abstract-authenticated-command.js:23:14)
    at async EnvironmentCommand._run (/usr/local/lib/node_modules/forest-cli/node_modules/@oclif/command/lib/command.js:29:20)
    at async Config.runCommand (/usr/local/lib/node_modules/forest-cli/node_modules/@oclif/config/lib/config.js:151:9)
    at async (/usr/local/lib/node_modules/forest-cli/node_modules/@oclif/command/lib/main.js:21:9)
    at async Main._run (/usr/local/lib/node_modules/forest-cli/node_modules/@oclif/command/lib/command.js:29:20)


node --version

npm --version

forest version
forest-cli/2.2.4 darwin-x64 node-v12.12.0

Hey @shdwraze, and welcome to our community :wave:

I’m currently unable to reproduce this issue. Could you please provide your project name so I can check if there is anything wrong with your environments?
Also, do you use any options with the forest environments:list ?

The latest version is 2.2.8 - but there are no fixes related to the issue you mentionned. It could be worth checking if you are still having issues with the latest version.

Thanks in advance :pray:

I’ve tried 2.2.8 but getting same erorr, my colleague able to view environments with 2.2.4(he on ubuntu and me on macos) so I gave a try.

Can I share project id instead of name?) ID - 73011

Did you configure a token within your admin panel to avoid the forest login in your CI context?
Do you provide any other argument to your forest environment:list command that could help me reproduce the issue on my end?
Could you try re-installing forest-cli using npm install -g forest-cli@latest (--force?) ?

I’m now testing from localhost(macos) not from ci and getting this error. I’ve logged in. Running just forest environments:list

Will try to reinstall now.

Force reinstall didn’t help.

That’s weird indeed.

Could you try running forest environments:list --format json and let me know if this one works?

Lol with --format json works fine. Thanks :slight_smile:

Well, there is still an issue though :confused:

I’ll take a look at our toolbelt code just to see if I can spot anything, the classic --format table should work as well.

Gl with that, i’m fine with json output. You can close this thread.

Thanks again :slight_smile:

1 Like