4

I am trying to deploy a node application which imports a private npm module to Google App Engine. I'm still stuck at npm install failing due to Unable to authenticate, need: Basic realm="GitHub Package Registry".

One method of npm authentication is via the NODE_AUTH_TOKEN environment variable. GAE does not accept environment variables via the command line, only app.yaml, so I added my token to the app.yaml during my Github Actions CI process. It turns out that App Engine uses a separate Cloud Build environment to build which doesn't have this environment variable; therefore, failure again. I also tried creating a cloudbuild.yaml and subbed in my environment variable but no luck there. Lastly, I've tried to set my key via .npmrc like so:

//npm.pkg.github.com/gw-cocoon/:_authToken=$NPM_TOKEN
@gw-cocoon:registry=https://npm.pkg.github.com/gw-cocoon

and subbed in the token during CI. This fails for the same reason but I am not sure why. This token is autogenerated on each CI run so I cannot use Google Cloud KMS.

halfer
  • 19,824
  • 17
  • 99
  • 186
jmalatras
  • 89
  • 7
  • Does [Installing packages from github npm registry - auth error 401](https://stackoverflow.com/questions/58919401/installing-packages-from-github-npm-registry-auth-error-401) answer your question? Also may be worth checking out this [GitHub issue](https://github.com/actions/setup-node/issues/52) on the subject from September. – sllopis Dec 12 '19 at 08:42

1 Answers1

0

I was disappointed to find that using private npm modules with App Engine Standard is apparently not supported at all. This seems like a pretty glaring limitation given the rising popularity of GitHub packages etc for building modular (private) applications.

Interestingly, Google Cloud Functions apparently supports private npm modules, so perhaps it's just a matter of timing to gain support in App Engine.

Myk Willis
  • 12,306
  • 4
  • 45
  • 62
  • Just found this related question: https://stackoverflow.com/questions/61114288/use-private-npm-registry-for-google-app-engine-standard – Myk Willis Nov 27 '20 at 01:35