We have two emulators under same firebase project. One with firestore, storage, auth on server PC and one with only functions on laptops. Because we didn't want to throw away all the data when re-run the emulator.
We tried to use functions trigger on another emulator's firestore but it didn't work with the message.
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp();
export const onSomeEventTrigger = functions.firestore
.document(`collection/users`)
.onCreate(async (snap, context) => {
// do something...
});
functions[us-central1-onSomeEventTrigger]: function ignored because the firestore emulator does not exist or is not running
What we tried:
- changed the value of
FIRESTORE_EMULATOR_HOST
in .env into host of server PC's emulator's firestore - passed config with database URL to
admin.initializeApp()
According to this question and documents, it looks possible to connect 1 functions with the firestores of multiple projects.
We're using the server's emulator in Flutter app, so it doesn't look like server's problem.
How can I use functions trigger on different emulator's firestore?