Andrew Bullock
Andrew Bullock

Reputation: 37378

Call Google Cloud API from local Firebase Emulator

I've got a function which uses @google-cloud/language.

The function works when deployed live but when running in the local function emulator it complains

I've done firebase login with my Google account but get the following when running the function:

Error: 7 PERMISSION_DENIED: Cloud Natural Language API has not been used in project XXXXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/language.googleapis.com/overview?project=XXXXX then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

XXXXX is a project Id I don't recognise - where has this come from and how can I check if I'm mistaken?

The account I'm authed with firebase locally is already in the Owner role for the project, so either the project ID is wrong, or I need to grant permissions to the user?

What do I need to do?

Upvotes: 1

Views: 170

Answers (1)

Andrew Bullock
Andrew Bullock

Reputation: 37378

The solution is to set the environment variable GOOGLE_APPLICATION_CREDENTIALS for authentication:

https://cloud.google.com/docs/authentication/getting-started#windows

And restart all the things due to my ENV variable not being updated.

Upvotes: 2

Related Questions