Skip to content
← Back to activity

Public problem

Google Secret Manager Could not load the default credentials from AWS Lambda nodejs client

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Creating secrets in GCP Secret Manager from an AWS Lambda using the Node.js client fails with: Error: Could not load the default credentials, even when projectId and the path to a service-account JSON key file are passed to the SecretManagerServiceClient constructor. Setting GOOGLEAPPLICATIONCREDENTIALS at runtime works, but passing the key file path directly does not.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The Google-recommended approach for AWS-to-GCP auth is Workload Identity Federation instead of long-lived service-account keys: configure a workload identity pool for the AWS account and use google.auth with the external-account credentials file. It avoids key-file path issues entirely. As a fallback, setting process.env.GOOGLEAPPLICATIONCREDENTIALS at runtime before constructing the client works.

Source: https://github.com/googleapis/nodejs-secret-manager/issues/196

Source: https://github.com/googleapis/nodejs-secret-manager/issues/196