Skip to content

[Bug] Code Apps CLI fails in GCC High during init and push #331

@kneely

Description

@kneely

npm Code Apps CLI fails in GCC High during init and push; PAC commands work as workaround

Summary

When using Code Apps in a GCC High environment, the npm-based Power Apps CLI appears to fail in two places:

  1. npx power-apps init --cloud gcchigh reports that a valid GCC High environment ID cannot be found.
  2. npx power-apps push fails with an encryption/decryption error.

I was able to work around both issues locally, so I wanted to document the behavior for maintainers and for other GCC High users who may hit the same problem.

Environment

  • Cloud: GCC High
  • Code Apps package: @microsoft/power-apps ^1.0.3
  • npm Code Apps CLI package observed in node_modules: @microsoft/power-apps-cli 0.11.0
  • Project type: Vite / React Code App
  • OS/shell: Windows PowerShell

Issue 1: npx power-apps init --cloud gcchigh rejects the environment ID

Command

npx power-apps init --cloud gcchigh

Prompt/input

Please provide the environment ID:
<gcc-high-environment-id>

Actual behavior

Environment '<gcc-high-environment-id>' not found. Please verify the environment ID and ensure you have access to it.

The same environment is valid and accessible in GCC High.

Workaround

Temporarily bypassing the environment existence check in the installed package allowed initialization to continue.

In node_modules\@microsoft\power-apps-cli\dist\Verbs\Init.js, comment out the environment existence throw:

// if (!environmentExists) {
//     throw new Error(`Environment '${environmentId}' not found. Please verify the environment ID and ensure you have access to it.`);
// }

Then run init with the environment supplied explicitly:

npx power-apps init --cloud gcchigh -e "<gcc-high-environment-id>"

After initialization succeeds, restore the original lines in Init.js so the local package matches the expected CLI behavior again.

Issue 2: npx power-apps push fails with encryption/decryption error

Command

npx power-apps push

Actual behavior

Encryption/Decryption failed. Error code: 2148073483

Workaround

Use the PAC command instead:

pac code push

That path completed successfully in the same project/environment.

Expected behavior

  • npx power-apps init --cloud gcchigh should validate GCC High environment IDs correctly.
  • npx power-apps push should work in GCC High, or the documentation should call out that GCC High users need to use pac code push for now.

Notes

The likely failure area for the first issue is the environment lookup used by the npm CLI before initialization. It may be calling an endpoint or authority that works for commercial cloud but does not resolve GCC High environments correctly. It's most likely line 29 "const environmentExists = await validateEnvironmentExists(environmentId);" in Init.js because it does not pass the cloud parameter and the error message matches the one thrown when the check fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions