firebase / firebase-functions-test

MIT License
232 stars 51 forks source link

FIRESTORE_EMULATORS_HOST's host ignored in clearFirestoreData #193

Open shackijj opened 1 year ago

shackijj commented 1 year ago

https://github.com/firebase/firebase-functions-test/blob/c1dd82b84f5fe4126ca666577a04a7d72e96f2fc/src/providers/firestore.ts#L275

'localhost' value is hardcoded. Thanks makes it impossibe to run emulators on another host.

I encountered this problem when trying to run tests in Dockerized environment.

diginikkari commented 1 year ago

Because of this clearFirestoreData is also failing with node 18 with ECONNREFUSED ::1:8080 error event though FIRESTORE_EMULATORS_HOST=127.0.0.1:8080 env variable is defined.

charneykaye commented 1 year ago

I notice that firebase-functions-test IS checking for env variable FIRESTORE_EMULATOR_HOST (as opposed to OP's plural FIRESTORE_EMULATORS_HOST)

dan-wu-open commented 5 months ago

@shackijj 's PR would be a good fix, but it hasn't been merged in a long time.

As a workaround, I set my host to "0.0.0.0" in firebase.json

    "firestore": {
      "host": "0.0.0.0",
    },