googlearchive / cloud-functions-emulator

A local emulator for deploying, running, and debugging Google Cloud Functions.
https://github.com/GoogleCloudPlatform/cloud-functions-emulator/wiki
Apache License 2.0
827 stars 115 forks source link

functions deploy completely ignores --local-path #314

Open gberliner opened 5 years ago

gberliner commented 5 years ago

[zzyzx@localhost firebase-functions-next-example]$ functions --version 1.0.0-beta.5

[zzyzx@localhost firebase-functions-next-example]$ functions deploy nextapp --entry-point app --local-path=./dist/functions/ --trigger-http ERROR: Function load error: Code could not be loaded. ERROR: Does the file exists? Is there a syntax error in your code? ERROR: Detailed stack trace: module.js:471 throw err; ^

Error: Cannot find module '/home/zzyzx/sandbox/firebase-functions-next-example' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at [eval]:1:40 at ContextifyScript.Script.runInThisContext (vm.js:25:33) at Object.runInThisContext (vm.js:97:38) at Object. ([eval]-wrapper:6:22) at Module._compile (module.js:570:32) at evalScript (bootstrap_node.js:347:27)

ERROR: Error: Failed to deploy function. at exec (/home/zzyzx/.npm-global/lib/node_modules/@google-cloud/functions-emulator/src/cli/controller.js:126:22) at ChildProcess.exithandler (child_process.js:205:5) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7) at maybeClose (internal/child_process.js:920:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)

[zzyzx@localhost firebase-functions-next-example]$ cd dist/functions/

[zzyzx@localhost functions]$ functions deploy nextapp --entry-point app --local-path=./dist/functions/ --trigger-http Copying file:///tmp/tmp-23743CMIkJcS69x2r.zip... Waiting for operation to finish...done. Deploying function..........done. Function nextapp deployed. ┌─────────────┬──────────────────────────────────────────────────────────────────────────┐ │ Property │ Value │ ├─────────────┼──────────────────────────────────────────────────────────────────────────┤ │ Name │ nextapp │ ├─────────────┼──────────────────────────────────────────────────────────────────────────┤ │ Entry Point │ app │ ├─────────────┼──────────────────────────────────────────────────────────────────────────┤ │ Trigger │ HTTP │ ├─────────────┼──────────────────────────────────────────────────────────────────────────┤ │ Resource │ http://localhost:8010/project-id-6454258612623283566/us-central1/nextapp │ ├─────────────┼──────────────────────────────────────────────────────────────────────────┤ │ Timeout │ 60 seconds │ ├─────────────┼──────────────────────────────────────────────────────────────────────────┤ │ Local path │ /home/zzyzx/sandbox/firebase-functions-next-example/dist/functions │ ├─────────────┼──────────────────────────────────────────────────────────────────────────┤ │ Archive │ file:///tmp/tmp-23743CMIkJcS69x2r.zip │ └─────────────┴──────────────────────────────────────────────────────────────────────────┘ [zzyzx@localhost functions]$

(notice i even left the bogus --local-path argument in there the second time; it ignored it, and only looked for index.js in current working directory!)

gberliner commented 5 years ago

accidentally closed..

tsukakei commented 5 years ago

Hi @gberliner , --local-path option doesn't exist anymore. Instead, we can use --source ( or -S) option!