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:
npx power-apps init --cloud gcchigh reports that a valid GCC High environment ID cannot be found.
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
Actual behavior
Encryption/Decryption failed. Error code: 2148073483
Workaround
Use the PAC command instead:
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.
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:
npx power-apps init --cloud gcchighreports that a valid GCC High environment ID cannot be found.npx power-apps pushfails 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
@microsoft/power-apps^1.0.3node_modules:@microsoft/power-apps-cli0.11.0Issue 1:
npx power-apps init --cloud gcchighrejects the environment IDCommand
Prompt/input
Actual behavior
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:Then run init with the environment supplied explicitly:
After initialization succeeds, restore the original lines in
Init.jsso the local package matches the expected CLI behavior again.Issue 2:
npx power-apps pushfails with encryption/decryption errorCommand
npx power-apps pushActual behavior
Workaround
Use the PAC command instead:
That path completed successfully in the same project/environment.
Expected behavior
npx power-apps init --cloud gcchighshould validate GCC High environment IDs correctly.npx power-apps pushshould work in GCC High, or the documentation should call out that GCC High users need to usepac code pushfor 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.jsbecause it does not pass the cloud parameter and the error message matches the one thrown when the check fails.