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

Function names with an underscore are not working properly.

Open viggy28 opened this issue 7 years ago • 0 comments

I had a function which has an underscore in its name and it didn't work as expected. Then i tested with a very simple function and it worked. I noticed there is an underscore in the actual function and that's the reason it wasn't working. Correct me if I am wrong.

 $ firebase experimental:functions:shell
i  functions: Preparing to emulate functions.
Warning: You're using Node.js v8.9.1 but Google Cloud Functions only supports v6.11.1.
info: before
info: after
✔  functions: post
firebase > post()
'Successfully invoked function.'
firebase > info: User function triggered, starting execution
info: inside
info: Execution took 6 ms, user function completed successfully

(To exit, press ^C again or type .exit)
firebase >
^C $ vi index.js
 $ //changing the function name from post to post_something
 $ firebase experimental:functions:shell
i  functions: Preparing to emulate functions.
Warning: You're using Node.js v8.9.1 but Google Cloud Functions only supports v6.11.1.
info: before
info: after
✔  functions: post_something
firebase > post_something();
'Successfully invoked function.'
firebase > info: before
info: after
error: /usr/local/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:68
      throw new Error(`No function found with name ${cloudfunction.entryPoint || name}`);
      ^

Error: No function found with name post
    at process.on (/usr/local/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:68:13)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emit (internal/child_process.js:772:12)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
error: Function worker crashed with exit code: 1

Environment details

  • OS: macOS Sierra 10.12.3
  • Node.js version: 8.9.1
  • npm version: 5.5.1
  • @google-cloud/functions-emulator version: Don't know how to find that.

Steps to reproduce

  1. Create a simple function with no underscore on its name. Invoke it. Should work fine.
  2. Change the same name of the function to include an underscore, invoke it. It should still look for the old function name.

Thanks!

viggy28 avatar Nov 24 '17 20:11 viggy28