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.