I am having an issue with gcloud and firebase interfering. I have a project that requires gcloud auth — however I started a new firebase project separate from my gcloud project. My firebase project should be using my firebase authentication — instead I am getting the following error:
Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.
> at GoogleAuth.getApplicationDefaultAsync (/Users/project/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:160:19)
> at processTicksAndRejections (internal/process/task_queues.js:97:5)
> at async GoogleAuth.getClient (/Users/project/functions/node_modules/google-auth-library/build/src/auth/googleauth.js:502:17)
> at async GrpcClient._getCredentials (/Users/project/functions/node_modules/google-gax/build/src/grpc.js:92:24)
> at async GrpcClient.createStub (/Users/project/functions/node_modules/google-gax/build/src/grpc.js:213:23)
If I do log into my account via gcloud auth login
then replacing GOOGLE_APPLICATION_CREDENTIALS
in .bash_project
— I do not get the error above. I do get the following warning:
Your GOOGLE_APPLICATION_CREDENTIALS environment variable points to /Users/.config/gcloud/legacy_credentials/xxx/xxx.json. Non-emulated services will access production using these credentials. Be careful!
From my understanding firebase does not need you to setup gcloud and should use the credentials giving at firebase login
, I’m not sure how to keep these two separate. I would prefer not to have to change GOOGLE_APPLICATION_CREDENTIALS
each time I need to switch projects and not to get the warning I’ve been receiving.
I don't think you can somehow fix this. Still, I've been able to think of four different workarounds for your scenario but I'm not sure they will fit your needs. They are sorted by how convenient they are: