Reputation: 11577
I've created a Node.js project (let's call it AA) in GC (Google cloud) Repository and then created another project (BB) and used AA
as a dependency:
"dependencies": {
"@slack/client": "^4.9.0",
"axios": "^0.18.0",
"big-integer": "^1.6.41",
"https-proxy-agent": "^2.2.1",
"moment": "^2.24.0",
"mongoose-auto-increment": "^5.0.1",
"mssql": "^4.3.0",
"xml2js": "^0.4.19",
"AA": "git+https://source.developers.google.com/p/AA/r/AA",
}
now when I try to deploy it to AppEngine:
gcloud -q app deploy server/app-prod.yaml --project BB
i'm getting Invalid authentication credentials.
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/AA/r/AA
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/new-password
Step #1: npm ERR!
Step #1: npm ERR!
Step #1: npm ERR!
Step #1: npm ERR! exited with error code: 128
Step #1:
Step #1: npm ERR! A complete log of this run can be found in:
Step #1: npm ERR! /root/.npm/_logs/2019-03-31T12_25_41_034Z-debug.log
Step #1: error building image: error building stage: waiting for process to exit: exit status 1
it seems the service running the build on the AppEngine doesn't have permissions of the AA repository. however, I have no idea which user is it or what permissions do I need to give him. I couldn't find any answers on it in google cloud pages and I don't have support package.
I hope someone other then I did it before and can help me.
I have AA
and BB
since the code used in AA
will be used in other projects as well (this is a utility project)
Upvotes: 0
Views: 240
Reputation: 1108
You can work around this problem by using a custom runtime and executing the git user initialisation script in your Dockerfile.
Add the dependency to your package.json the same way you did in your question
"AA": "git+https://source.developers.google.com/p/AA/r/AA"
Obtain the initialisation script by going to this URL and following the authentication steps.
Store it in a file in your project's root directory. Change the runtime in your app.yaml to 'custom'. Add a Dockerfile like the following:
FROM gcr.io/google_appengine/nodejs
RUN /usr/local/bin/install_node '>=8.0.0'
COPY . /app/
#Change to filename of the script stored in step 1
RUN /bin/bash /app/auth.bash
RUN npm install --unsafe-perm || \
((if [ -f npm-debug.log ]; then \
cat npm-debug.log; \
fi) && false)
CMD npm start
Run gcloud app deploy
Upvotes: 1