Skip to content

Cannot call scheduled function from emulated functions shell #3490

Closed

Description

@jsakas

[REQUIRED] Environment info

firebase-tools: 9.12.1

Platform: macOS Big Sur Version 11.3.1

[REQUIRED] Test case

https://github.com/jsakas/firebase-test-pubsub

I am calling this a bug because I am pretty sure I was using this functionality a few weeks ago. I had actually used the emulators in combination with the functions shell to test a scheduled function. However, some google searching leads me to believe maybe this isn't implemented and I am just confused. Hopefully someone here knows. 😅

[REQUIRED] Steps to reproduce

There are two functions defined: helloWorld and helloPubSub.

cd functions
npm run serve

Calling helloWorld() gives the expected output (function runs)

Calling helloPubSub() gives the following error:

Uncaught FirebaseError: Could not find trigger helloPubSub
    at FunctionsEmulatorShell.getTrigger (/Users/jonsakas/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorShell.js:52:19)
    at FunctionsEmulatorShell.call (/Users/jonsakas/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorShell.js:25:30)
    at LocalFunction._call (/Users/jonsakas/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/localFunction.js:186:29) {
  children: [],
  context: undefined,
  exit: 1,
  original: undefined,
  status: 500
}

[REQUIRED] Expected behavior

The helloPubSub function runs on demand.

[REQUIRED] Actual behavior

See error above.

Activity

  1. ryor1986 commented on Jun 15, 2021

    @ryor1986

    Same issue from firebase functions:shell.
    Trigger should be found with 'id' but found with 'name' now.
    parameter id's value is name now.
    call(id: string, data: any, opts: any): void { const trigger = this.getTrigger(id); ....
    https://github.com/firebase/firebase-tools/blob/master/src/emulator/functionsEmulatorShell.ts

    As workaround, you can update firebase-tools to v9.11.0 until fix.

  2. samtstern commented on Jun 15, 2021

    @samtstern
    Contributor

    Seems similar to this one:
    #3427

    I'll check it out.

  3. self-assigned this
    on Jun 15, 2021
  4. jsakas commented on Jun 15, 2021

    @jsakas
    Author

    As workaround, you can update firebase-tools to v9.11.0 until fix.

    Confirming this works, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions