You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A clear and concise description of what the bug is, and what you expected to happen.
I have attempted a trivial usage of the Google Maps Platform's Address Validation API from an AWS Lambda function today. This service uses an API key for authentication.
It takes ~15 seconds for execution to resume at the API call site. Upon inspection—primarily via NODE_DEBUG=http—I can see three failed attempts to connect to a GCP metadata endpoint at 169.254.169.254 which each have a five second timeout.
As documented I am using the apiKey auth strategy for the Address Validation API. Looking at the code, it seems that GoogleAuth's getClient() method kicks off a call stack which ends up making a call into the gcp-metadata package's project() function in my use-case. This then in turn attempts to reach a link-local metadata server, and this then becomes slow.
To validate that this is indeed the issue I have set the environment variable GOOGLE_CLOUD_PROJECT on my AWS Lambda function and verified that no attempts are then made to reach a metadata service.
I can't find any documentation which suggests I am doing anything wrong, so I'm raising this here in the belief that this represents a bug. Sorry if I'm wrong.
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
The text was updated successfully, but these errors were encountered:
jstephenson
changed the title
Use of GoogleAuth.getClient() via gax-nodejs via google-cloud-node causes slow metadata fetch attempt in AWS
Use of GoogleAuth.getClient() via gax-nodejs via @googlemaps/addressvalidation in AWS Lambda causes slow GCE metadata fetch attempt
Mar 4, 2025
Please make sure you have searched for information in the following guides.
A screenshot that you have tested with "Try this API".
API does not seem to be available in the explorer
Link to the code that reproduces this issue. A link to a public Github Repository or gist with a minimal reproduction.
https://gist.github.com/jstephenson/d8a44a2d28b73923796952aa8a02d081
A step-by-step description of how to reproduce the issue, based on the linked reproduction.
google-auth-library-nodejs/src/auth/googleauth.ts
Lines 299 to 303 in a511e56
A clear and concise description of what the bug is, and what you expected to happen.
I have attempted a trivial usage of the Google Maps Platform's Address Validation API from an AWS Lambda function today. This service uses an API key for authentication.
It takes ~15 seconds for execution to resume at the API call site. Upon inspection—primarily via
NODE_DEBUG=http
—I can see three failed attempts to connect to a GCP metadata endpoint at169.254.169.254
which each have a five second timeout.As documented I am using the
apiKey
auth strategy for the Address Validation API. Looking at the code, it seems thatGoogleAuth
'sgetClient()
method kicks off a call stack which ends up making a call into thegcp-metadata
package'sproject()
function in my use-case. This then in turn attempts to reach a link-local metadata server, and this then becomes slow.To validate that this is indeed the issue I have set the environment variable
GOOGLE_CLOUD_PROJECT
on my AWS Lambda function and verified that no attempts are then made to reach a metadata service.I can't find any documentation which suggests I am doing anything wrong, so I'm raising this here in the belief that this represents a bug. Sorry if I'm wrong.
A clear and concise description WHY you expect this behavior, i.e., was it a recent change, there is documentation that points to this behavior, etc. **
The Address Validation API uses API key authentication and this appears to be supported by the SDK
The text was updated successfully, but these errors were encountered: