1
votes

I have some pub / sub setup on Google Cloud and I have some Cloud Functions running on Firebase.

I'd like to set a trigger on Firebase, so when a user account is created, I publish a message to a topic on Google Cloud.

Is this possible? Am I missing something obvious?

I can trigger a cloud function on account creation and I'm happy at this point showing a console log.

I was considering in my Firebase trigger add something like @google-cloud/pubsub so I can literally setup the message in the body of my firebase trigger, but that feels a little wrong.

Quite clunky and not the way it should be done?

In short, I guess what I'm trying to do is firebase publish to topic on trigger?

1

1 Answers

0
votes

I don't think there's anything wrong with what you're suggesting as a solution. You can use an authentication trigger to find out when a new user account is created, then use the node Cloud Pubsub SDK to turn around and publish a message to your topic. There's really no more straightforward way to accomplish this that I can think of.

It's pretty common to mix Cloud APIs into your Cloud Functions, regardless if they're based on Cloud or Firebase events.