1

I have 50 realtime firebase database instances which are all identical.

Is it possible to get all my firebase functions to trigger on all instances, rather than just the default instance?

I know you can do this

exports.myWriteFunction = functions.database.instance('my-secondary-db').ref('path/to/data').onUpdate((snap, context) => { ... })

But I really want to run this function on every instance...

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Paul de Wit
  • 467
  • 1
  • 4
  • 17

1 Answers1

4

There is no way to automatically associate a function with all database instances. You will have to associate it with each in your own code, although you can of course simply define a single function body that you associate all of them with:

const myfunc = (snap, context) => { ... }
exports.myWriteFunction1 = functions.database.instance('my-secondary-db').ref('path/to/data').onUpdate(myfunc)
exports.myWriteFunction2 = functions.database.instance('my-tertiary-db').ref('path/to/data').onUpdate(myfunc)
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807