Search code examples
google-cloud-platformgcloudgoogle-cloud-buildgoogle-cloud-iam

gcloud - ERROR: (gcloud.app.deploy) Permissions error fetching application


I am trying to deploy node js app on google cloud but getting following error -

Step #1: ERROR: (gcloud.app.deploy) Permissions error fetching application [apps
/mytest-240512]. Please make sure you are using the correct project ID and that
you have permission to view applications on the project.

I am running following command -

gcloud builds submit . --config cloudbuild.yaml

My cloudbuild.yaml file looks like -

steps:
  #install
  - name: 'gcr.io/cloud-builders/npm'
    args: ['install']

   #deploy
  - name: 'gcr.io/cloud-builders/gcloud'
    args: ['app', 'deploy']

Solution

  • The default Cloud Build service account does not allow access to deploy App Engine. You need to enable the Cloud Build service account to perform actions such as deploy.

    The Cloud Build service account is formatted like this:

    [PROJECT_NUMBER]@cloudbuild.gserviceaccount.com
    
    • Go to the Google Cloud Console -> IAM & admin -> IAM.
    • Locate the service account and click the pencil icon.
    • Add the role "App Engine Deployer" to the service account.

    Wait a couple of minutes for the service account to update globally and then try again.