2

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...

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

3 Comments

Can I export 2 functions with the same name?
If I can export 2 functions with the same name how does this count towards the 1000 function quota?
Sorry, that was just a copy/paste mistake. Updated now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.