GoogleCloudPlatform / cloud-code-vscode

Cloud Code for Visual Studio Code: Issues, Documentation and more
Other
415 stars 111 forks source link

Using Cloud Run emulator with service account: Request had invalid authentication credentials #864

Closed ivan-toriya-precis closed 11 months ago

ivan-toriya-precis commented 11 months ago

Environment

Operating System: Ubuntu 23.10
Kernel: Linux 6.5.0-10-generic Architecture: x86-64 Hardware Vendor: Lenovo Hardware Model: ThinkPad T490s Firmware Version: N2JETA2W (1.80 ) Firmware Date: Tue 2023-07-25

Version information

Cloud Code Extension version: 2.1.1

VSCode version: Version: 1.84.0 Commit: d037ac076cee195194f93ce6fe2bdfe2969cc82d Date: 2023-11-01T11:28:21.782Z Electron: 25.9.2 ElectronBuildId: 24603566 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Linux x64 6.5.0-10-generic

Cloud SDK: 453.0.0

Description:

When trying to "Run on Cloud Run Emulator" with specified service account, I get

# Output: Cloud Run: Run/Debug
Starting to run the app using configuration 'Cloud Run: Run/Debug Locally' from .vscode/launch.json...
To view more detailed logs, go to Output channel : "Cloud Run: Run/Debug Locally - Detailed"
Dependency check started
Dependency check succeeded
ERROR: (gcloud.alpha.code.export) UNAUTHENTICATED: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
- '@type': type.googleapis.com/google.rpc.ErrorInfo
  metadata:
    method: google.iam.admin.v1.IAM.GetServiceAccount
    service: iam.googleapis.com
  reason: ACCESS_TOKEN_TYPE_UNSUPPORTED

I'm gcloud auth application-default logined and I have roles/iam.serviceAccountUser and roles/roles/iam.serviceAccountTokenCreator on the service account I'm trying to use.

Repro step:

  1. gcloud auth application-default login
  2. Delete launch.json in .vscode/
  3. Click "Run on Cloud Run Emulator" and specify service account to use in Advanced settings
  4. Check the logs
ivan-toriya-precis commented 11 months ago

Seems working with Cloud Code v2.2.0-insiders.5