google-cloud-node icon indicating copy to clipboard operation
google-cloud-node copied to clipboard

Can't authenticate via Node.js in Pipedream

Open andrii1 opened this issue 2 years ago • 1 comments

Hello, I'm using google Cloud with Pipedream and authentication doesn't work.

// Imports the Google Cloud client library.
const {Storage} = require('@google-cloud/storage');

// Instantiates a client. If you don't specify credentials when constructing
// the client, the client library will look for credentials in the
// environment.
console.log(auths.google_cloud.key_json.client_email)
console.log(auths.google_cloud.key_json.client_id)
const credentials = {
  client_email: auths.google_cloud.key_json.client_email,
  private_key: auths.google_cloud.key_json.private_key
}
const storage = new Storage();
// Makes an authenticated API request.
async function listBuckets() {
  try {
    const results = await storage.getBuckets();

    const [buckets] = results;

    console.log('Buckets:');
    buckets.forEach(bucket => {
      console.log(bucket.name);
    });
  } catch (err) {
    console.error('ERROR:', err);
  }
}
listBuckets();

Specifically, the issue is with a path to .json file with a key. I have uploaded it to pipedrive, but still doesn't work. Any suggestions?

andrii1 avatar Jan 02 '22 15:01 andrii1

Where is the file located? Do you set the environment variable "GOOGLE_APPLICATION_CREDENTIALS"?

This page has some detailed info.

tmatsuo avatar Jan 04 '22 17:01 tmatsuo