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

httpTimeout option in initializeApp

Open jashment opened this issue 4 years ago • 5 comments
trafficstars

Is your feature request related to a problem? Please describe. In the Python implementation of firebase_admin, there is an option on initialize_app that allows the httpTimeout to be set manually. There is no such implementation in NodeJS.

Describe the solution you'd like The desired solution is to have the same functionality of httpTimeout in the Python firebase_admin, implemented for the NodeJS firebase-admin.

Additional context Using firebase-admin version 9.4.2

jashment avatar Jun 17 '21 19:06 jashment

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 Jun 17 '21 19:06 google-oss-bot

as far as I can tell, if you provide an invalid databaseURL to initializeApp() the call will simply fail silently and all subsequent API calls will hang indefinitely with no error reported.

this is very bad behavior, firebase should fail loudly and quickly in this case rather than silently failing. this exact issue led to a longer delay in mitigating an outage in my product today.

note, it seems like this was raised several years ago in #116, but the resolution was simply to add a URL validator that rejects malformed URLs. this is useful, but does not address the actual issue. IMO, that issue remains unresolved and it should not have been closed.

try:

admin.initializeApp({
    databaseURL: 'https://example.com',
})

this code will not produce any errors, but all firebase API calls (e.g. RTDB) will silently fail and hang indefinitely.

aroman avatar Jun 18 '21 23:06 aroman

This is pretty important. Currently spending the better part of a day trying to diagnose why set() is blackholing ( i assume initializeApp() is failing somehow)

jasonlewicki avatar Oct 29 '21 18:10 jasonlewicki

set() as in Firestore?

An httpTimeout option will not apply to Firestore (or RTDB). Those APIs are provided by different libraries, and employ different protocols. The proposed httpTimeout option will only apply to APIs that employ HTTP/REST under the hood (e.g. Auth, FCM, App Check etc).

hiranya911 avatar Oct 29 '21 18:10 hiranya911

Turns out FIREBASE_DATABASE_EMULATOR_HOST being set even though specifying a specific databaseURL for initializeApp ended up being the cause of my problem.

jasonlewicki avatar Oct 29 '21 20:10 jasonlewicki