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?

3
  • 1
    A quick search seems to indicate that others have used this syntax before without problems: 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? Commented May 17, 2021 at 1: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. Commented May 17, 2021 at 2: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. Commented May 17, 2021 at 3:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.