Facing error while deploying node.js app on google cloud

懵懂的女人 提交于 2021-02-11 14:14:23

问题


I am trying to deploy node.js app on google cloud but getting following error. I am facing this error since 10th October. don't know how to resolve:

Step #2: ERROR: (gcloud.beta.app.deploy) PERMISSION_DENIED: You do not have permission to act as '[xxxxxxx]@appspot.gserviceaccount.com'
Step #2: - '@type': type.googleapis.com/google.rpc.ResourceInfo
Step #2:   description: You do not have permission to act as this service account.
Step #2:   resourceName: [xxxxxx]@appspot.gserviceaccount.com
Step #2:   resourceType: serviceAccount
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/cloud-builders/gcloud" failed: step exited with non-zero status: 1

CloudBuild.yaml:

steps:

- name: node:10.15.1
  entrypoint: npm
  args: ['install']

- name: node:10.15.1
  entrypoint: npm
  args: [ 'run', 'build', '--prod --verbose']

- name: 'gcr.io/cloud-builders/gcloud'
  args: ['beta', 'app', 'deploy', '--version=prod', '--no-cache']


timeout: '4800s'

回答1:


I believe you should grant the Service Account User permission to my CI/CD service account.

You can use the console UI or gcloud command:

Granting, changing, and revoking access to resources

gcloud iam service-accounts add-iam-policy-binding \
    ${PROJECT_ID}@appspot.gserviceaccount.com \
    --member=serviceAccount:${PROJECT_NUMBER}@cloudbuild.gserviceaccount.com \
    --role=roles/iam.serviceAccountUser \
    --project=${PROJECT_ID}


来源:https://stackoverflow.com/questions/64331395/facing-error-while-deploying-node-js-app-on-google-cloud

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!