Appcenter-cli: Error: Cannot read environment of null - Codepush

Created on 21 Feb 2018  路  2Comments  路  Source: microsoft/appcenter-cli

Hi all! 馃憢

I'm working in transition from codepush-cli to appcenter-cli, and I got a problem using it in my CI.

I'm running the command:

appcenter codepush release-react --token <token> --app <appName> -d <deploymentName>.

It works fine until it try to get an environment name in this part of the code:

https://github.com/Microsoft/appcenter-cli/blob/master/src/commands/codepush/lib/release-command-skeleton.ts#L106

Since I didn't pass an env name and getUser returns null since I'm not logged, it cause an exception:

Cannot read environment of null.

Debugging appcenter-cli, I discover that env name is used here:

https://github.com/Microsoft/appcenter-cli/blob/master/src/util/profile/environments.ts

It looks like something internal, to determine which entrypoint will be used. It has a default value that is prod. I forced the --env flag to prod, but it's not look the correct way, I want to check if this is the "correct" solution, or we enter in a bug?

I could help to fix this, IMO we just need to define an empty object value in casegetUser returns null, but I just want to figure out first if is a reasonable way.

CodePush

Most helpful comment

I faced the same issue and created a Pull Request to fix it.
https://github.com/Microsoft/appcenter-cli/pull/389

All 2 comments

I faced the same issue and created a Pull Request to fix it.
https://github.com/Microsoft/appcenter-cli/pull/389

Merged the pr, fix will go out in next release.

Was this page helpful?
0 / 5 - 0 ratings