firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

Impossible to specify an httpAgent when running on GCP infrastructure

Open brettwillis opened this issue 1 year ago • 1 comments

An HTTP agent can be specified in initializeApp() using AppOptions.httpAgent.

When running on GCP infrastructure using application default credentials, the SDK will request the internal metadata server at an http: address, see below:

https://github.com/firebase/firebase-admin-node/blob/581e579460bd809912dbffd5680777dd0c8f1a80/src/app/credential-internal.ts#L261-L270

And naturally, all other API requests during operation of the SDK use the https: protocol.

This means that it is impossible to provide a native NodeJS http.Agent or a https.Agent because it will always fail due to the mix of http: and https: requests it will be used for.

This should either be fixed (e.g. don't use the provided agent for the internal metadata server http: request) or documented.

brettwillis avatar Aug 19 '22 02:08 brettwillis

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Aug 19 '22 02:08 google-oss-bot