我正在使用firebase cloud functions emulator。这是我的文件夹结构
├── firebase.json
├── functions
│ ├── etc
│ ├── index.js
│ ├── package.json
│ ├── src
│ │ ├── ArrayFromObject.ts
│ │ ├── Equations.ts
│ │ └── index.ts
│ ├── tsconfig.json
│ └── tslint.json
└── tree.txt
如果我位于主文件夹中,那么在firebase.json
级别并运行sudo functions call helloWorld
时,我会得到:
Error: { error:
{ code: 500,
status: 'INTERNAL',
message: 'Function worker crashed with exit code: 1\nundefinedWarning, estimating Firebase Config based on GCLOUD_PROJECT. Intializing firebase-admin may fail/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:80\n throw new Error(`No function found with name ${cloudfunction.entryPoint || name}`);\n ^\n\nError: No function found with name helloWorld\n at process.on (/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:80:13)\n at emitTwo (events.js:126:13)\n at process.emit (events.js:214:7)\n at emit (internal/child_process.js:772:12)\n at _combinedTickCallback (internal/process/next_tick.js:141:11)\n at process._tickCallback (internal/process/next_tick.js:180:9)',
errors:
[ 'Function worker crashed with exit code: 1\nundefinedWarning, estimating Firebase Config based on GCLOUD_PROJECT. Intializing firebase-admin may fail/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:80\n throw new Error(`No function found with name ${cloudfunction.entryPoint || name}`);\n ^\n\nError: No function found with name helloWorld\n at process.on (/usr/local/lib/node_modules/@google-cloud/functions-emulator/src/supervisor/worker.js:80:13)\n at emitTwo (events.js:126:13)\n at process.emit (events.js:214:7)\n at emit (internal/child_process.js:772:12)\n at _combinedTickCallback (internal/process/next_tick.js:141:11)\n at process._tickCallback (internal/process/next_tick.js:180:9)' ] } }
我不知道这是怎么回事。
如果我运行sudo函数,我会得到:
Google Cloud Functions Emulator RUNNING
┌────────┬────────────┬─────────┬────────────────────────────────────────────────────────┐
│ Status │ Name │ Trigger │ Resource │
├────────┼────────────┼─────────┼────────────────────────────────────────────────────────┤
│ READY │ helloWorld │ HTTP │ http://localhost:5000/uczsieapp/us-central1/helloWorld │
└────────┴────────────┴─────────┴────────────────────────────────────────────────────────┘
但是,如果我转到此网址,我会得到
如果我尝试从functions
目录运行,则会发生相同的事情
这是我的helloWorld代码:
export const helloWorld = functions.https.onRequest((req, resp) => {
return 'hello';
});
我想念什么?