Dshiz
Dshiz

Reputation: 3341

VS Code using wrong Google Cloud account when running project locally with Google Kubernetes Engine

I am using VS Code with Google's Cloud Code plugin. I was using my personal email address which is tied to a personal instance of Google Cloud. I was given a sandbox instance of Google Cloud for a project at work. Although I have logged into Google Cloud with my work email address, whenever I try to run my project with Cloud Code in a Kubernetes development session, an error is logged about permissions referencing my personal account. I believe this is because VS Code is somehow stuck with my personal email address.

I tried logging out of all accounts from the VS Code command pallet to no avail.

How do I resolve this?

Here is the error in GCP logging. I was clued in that it was my personal account's email address because of the logging entry's label: principal_email: [email protected]. Naturally, my personal email address is not part of my work's GCP instance, therefore the permissions issue.

{
insertId: "redacted"
logName: "projects/redacted/logs/cloudaudit.googleapis.com%2Factivity"
protoPayload: {
@type: "type.googleapis.com/google.cloud.audit.AuditLog"
authenticationInfo: {1}
authorizationInfo: [2]
metadata: {1}
methodName: "storage.buckets.create"
requestMetadata: {4}
resourceLocation: {1}
resourceName: "projects/_/buckets/redacted"
serviceName: "storage.googleapis.com"
status: {1}}
receiveTimestamp: "2022-09-09T12:07:41.184289826Z"
resource: {2}
severity: "ERROR"
timestamp: "2022-09-09T12:07:40.135804318Z"
}

I apologize if this is the wrong stack exchange for this question. If so, please direct me to the right one.

Upvotes: 0

Views: 908

Answers (1)

According with @Dshiz the solution was:

It was definitely some kind of corruption of the plugin. I uninstalled/reinstalled it, then signed out and back in via the plugin's Help and Feedback menu (which coincidentally was missing before reinstall), and the error cleared.

Upvotes: 2

Related Questions