4

I'm trying to deploy a node.js program in Google Cloud's App Engine, but am being given the following error:

Step #1: npm ERR! Error while executing:
Step #1: npm ERR! /usr/bin/git ls-remote -h -t https://source.developers.google.com/p/(project)/r/(repository)
Step #1: npm ERR! 
Step #1: npm ERR! fatal: remote error: 
Step #1: npm ERR! 
Step #1: npm ERR! 
Step #1: npm ERR! Invalid authentication credentials.
Step #1: npm ERR! 
Step #1: npm ERR! Please generate a new identifier:
Step #1: npm ERR!   https://source.developers.google.com/auth/start?scopes=https://www.googleapis.com/auth/cloud-platform
Step #1: npm ERR! 
Step #1: npm ERR! 
Step #1: npm ERR! 
Step #1: npm ERR! exited with error code: 128

This is because of a dependency in my project located at https://source.developers.google.com/p/(project)/r/(repository). I am able to install this dependency without errors both on my local machine and in the cloud shell with the help of a .netrc file, as described by the page given in the error message, but it seems that I am unable to copy this file in my deployment.

Is there a way to specify what credentials should be used? Note that I am unable to use the user:pass@host format explained in the npm docs because the username and password Google give me contain @s and \s.

Andrew Ault
  • 569
  • 3
  • 12
  • 1
    I assumed this wasn't possible because google force you to use their own gcloud tools to clone repositories. When I try to `npm install ` I get the `ENOPACKAGEJSON` error - which I think suggests npm could access the link but could not find a `package.json`. – 8eecf0d2 Feb 13 '18 at 08:01
  • 1
    Based on [this issue](https://github.com/npm/npm/issues/19262), it seems that this may be possible by encoding the password and requiring the package that way. Unfortunately, I'm no longer able to test this because I've since moved my code away from Google's repositories. – Andrew Ault Feb 13 '18 at 19:06

1 Answers1

1

I managed to get this working using the following recipe:

  1. The source url has to start with git+https://, not just https:// (thanks Lugassy), don't use username or password
  2. Fetch a piece of google magic from Google's Git configurator
  3. Run the command from Google in terminal
Sami Hult
  • 3,052
  • 1
  • 12
  • 17