Firebase-tools: [Broken?] Support for scheduled pubsub functions in emulator

Created on 18 Mar 2020  Â·  2Comments  Â·  Source: firebase/firebase-tools

[REQUIRED] Environment info


firebase-tools: 7.15.0 & 7.15.1


Platform: macOS 18.7.0 Darwin Kernel Version 18.7.0:

[REQUIRED] Test case

export const pubsubScheduled = functions.pubsub
  .schedule('every 1 minutes')
  .onRun(context => {
    console.log('Resource', JSON.stringify(context.resource));
    return true;
  });

[REQUIRED] Steps to reproduce

firebase emulators firebase emulators:start
✔ functions[pubsubScheduled]: pubsub function initialized.

[REQUIRED] Expected behavior

Logging every 1 minute in the console

[REQUIRED] Actual behavior

No output

Links:
https://github.com/firebase/firebase-tools/commit/b6fa88aa166bddc8969cbed7bd3b35392e307dd5

https://github.com/firebase/firebase-tools/commit/4dc64dac1d54f9e863fa2a99769bca447320940f

https://github.com/firebase/firebase-tools/pull/1543#issuecomment-600763141

emulator-suite functions pubsub feature request

Most helpful comment

@Elyx0 I think we maybe misled with how we represented https://github.com/firebase/firebase-tools/pull/2011

It lets those functions be loaded into the emulator but doesn't actually trigger them on a schedule. Instead you'd have to manually trigger them using a Pub/Sub message.

This was mostly meant for use within functions:shell but I can definitely see how this is confusing and we need to clarify it.

All 2 comments

@Elyx0 I think we maybe misled with how we represented https://github.com/firebase/firebase-tools/pull/2011

It lets those functions be loaded into the emulator but doesn't actually trigger them on a schedule. Instead you'd have to manually trigger them using a Pub/Sub message.

This was mostly meant for use within functions:shell but I can definitely see how this is confusing and we need to clarify it.

Thanks for clarifying @samtstern I'll wrap them in a setInterval in the global scope if it detects the emulator

Was this page helpful?
0 / 5 - 0 ratings