google-cloud-node
google-cloud-node copied to clipboard
Can't authenticate via Node.js in Pipedream
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?
Where is the file located? Do you set the environment variable "GOOGLE_APPLICATION_CREDENTIALS"?
This page has some detailed info.