serverless / serverless-google-cloudfunctions

Serverless Google Cloud Functions Plugin – Adds Google Cloud Functions support to the Serverless Framework
https://www.serverless.com
MIT License
271 stars 127 forks source link

Service Account Configuration #161

Open songx23 opened 5 years ago

songx23 commented 5 years ago

When deploying GCP cloud functions, serverless framework always uses the default AppEngine service account. If I delete that default account and deploy, then I get this error message:

{  
   "ResourceType":"cloudfunctions.v1beta2.function",
   "ResourceErrorCode":"400",
   "ResourceErrorMessage":{  
      "code":400,
      "message":"Default service account '<project_id>@appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.",
      "status":"FAILED_PRECONDITION",
      "details":[  

      ],
      "statusMessage":"Bad Request",
      "requestPath":"https://cloudfunctions.googleapis.com/v1beta2/projects/<project_id>/locations/asia-east2/functions",
      "httpMethod":"POST"
   }
}

Is there a way for developers to specify which service account to use, as the flag --service-account=xxx@xxx in gcloud command? If not, I think this should be a nice feature to add. Also, when will the resource type upgrade to v1?

mrdulin commented 5 years ago

same issue. Here is how to set service account using gcloud sdk.

gcloud functions deploy --service-account=xxx@xxx

Does serverless framework or this plugin support set --service-account? https://cloud.google.com/sdk/gcloud/reference/alpha/functions/deploy#--service-account

davedc commented 2 years ago

This was already implemented here

functions:
  a-function:
    serviceAccountEmail: your-sa@your-project.iam.gserviceaccount.com