Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot call scheduled function from emulated functions shell #3490

Closed
jsakas opened this issue Jun 14, 2021 · 3 comments · Fixed by #3491
Closed

Cannot call scheduled function from emulated functions shell #3490

jsakas opened this issue Jun 14, 2021 · 3 comments · Fixed by #3491

Comments

@jsakas
Copy link

jsakas commented Jun 14, 2021

[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.

@ryor1986
Copy link

ryor1986 commented Jun 15, 2021

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.

@samtstern
Copy link
Contributor

Seems similar to this one:
#3427

I'll check it out.

@jsakas
Copy link
Author

jsakas commented Jun 15, 2021

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants