cloud-functions-emulator icon indicating copy to clipboard operation
cloud-functions-emulator copied to clipboard

Trigger background functions using the pubsub emulator

Open agonbina opened this issue 8 years ago • 6 comments

Note: this is a feature request

Description

It would be great to have functions that are subscribed to pubsub topics trigger when a new message is published in this topic, locally, in the pubsub emulator.

On startup, the emulator could check if there is a PUBSUB_EMULATOR_HOST env variable set, which would signal that the pubsub emulator is running. The @google-cloud/pubsub node sdk is aware of this env variable and is able to talk to the emulator instead of a production pubsub service.

The emulator can then subscribe to the topics each background function is bound to and trigger them on every message respectively.

Do you think this is something that could be supported in the future? Thanks!

agonbina avatar Jan 26 '17 23:01 agonbina

This sounds like a great feature! I think we can do it.

jmdobry avatar Feb 01 '17 18:02 jmdobry

Just adding support for this - it would be awesome and just what I'm looking for. Thanks.

MrWako avatar Jun 20 '17 10:06 MrWako

Any news on this? I just spent quite some time wondering why my function wasn't being triggered after using functions deploy .... --trigger-topic ... to set it up. Never crossed my mind that the two emulators would not work together!

oliversturm avatar Nov 24 '17 15:11 oliversturm

..bump

o1lab avatar Mar 12 '18 12:03 o1lab

Any updates on this issue? I'm glad I found it because I thought my code wasn't working. I suspected it might be the emulator, but couldn't find any docs that described the issue.

valendesigns avatar Apr 22 '18 02:04 valendesigns

This would be awesome for developing a pipeline and seeing it work during integration testing.

knitterb avatar May 02 '18 21:05 knitterb