How to fix "Error: The incoming JSON object does not contain a client_email field"?

cloud GCP vision

While working with Google Cloud Vision, I got this error:

Error: The incoming JSON object does not contain a client_email field

Here is what I was doing to fix this error.

Step 1: I opened a project in Google Cloud Platform related to my application.

Step 2: I Opened IAM & Admin > Service Accounts page.

Step 3: Then I clicked Create key on one of my service accounts rows:

IAM & Admin

Step 4: There was a message about creating a key:

Create private key

I selected JSON as a key type. Then pressed Create.

A file has been saved to my computer:

Private key saved

Step 5: Because I had this error in the local Node.js project I ran the following in the project directory:

export GOOGLE_APPLICATION_CREDENTIALS="/<private-key-file>.json"

With this command, you are setting the path to the private key.

Important. If you close the terminal, you need to rerun the command from this step. This command works per one shell-session.

Step 6: I ran again my app and the issue was resolved.

comments powered by Disqus