0

I have separate databases and I want them to all do the same command where they delete some data after an hour. I can't figure out how to use the onCreate command for the databases that are not the default database.

This is what I used for the default database onCreate call, and it was called.

export const onMessageCreate = functions.database.ref('/{postID}').onCreate(async (snapshot, context) => {
  console.log(`HELLO`);
});

I tried using this below, but as a replacement for above, but I got no print out.

functions.database.instance('otherDatabaseID').ref('/{coordinates}')

Anyone know how to trigger onCreate with a database ID?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Ari Wasch
  • 19
  • 3
  • 1
    A quick search seems to indicate that others have used this syntax before without problems: https://www.google.com/search?q=functions.database.instance. Is there anything special about your instance? For example, is it running in one of the newer regions (Europe and Asia)? If so, does the problem also happen when you try the same against a database in the original US region? – Frank van Puffelen May 17 '21 at 01:54
  • I'm using the US central region. Nothing is special about my database other than the fact that I want to use a database ID to trigger a response when an entry is created. – Ari Wasch May 17 '21 at 02:56
  • Having a parameter in the path is very common, and unrelated to the database instance as far as I can see (it's a bit hard to say since you're showing a fake instance ID). I'm not sure what's going wrong here, so hope somebody else spots it. – Frank van Puffelen May 17 '21 at 03:43

0 Answers0