[英]why firebase functions onCall not deploy?
我在index.ts中有打字稿代碼
import * as functions from "firebase-functions";
import * as cors from "cors";
cors({ origin: true });
exports.myFunc = functions.https.onCall((data, context) => {
const { uid } = context.auth;
return { uid };
});
如果我嘗試部署此功能:
firebase deploy --only functions:myFunc
我回來了:
函數:指定了以下過濾器,但與項目中的任何功能都不匹配:myFunc
我究竟做錯了什么 ?
我發現了一個錯誤。 Typescript編譯目錄lib/functions/src/index.js
.js文件,但我的package.json文件具有主文件的路徑
{
...
"main": "lib/index.js",
...
}
我改為
{
...
"main": "lib/functions/src/index.js",
...
}
而且有效!
// index.js
const functions = require('firebase-functions');
const cors = require('cors');
cors({ origin: true });
exports.myFunc = functions.https.onCall((data, context) => {
const { uid } = context.auth;
return { uid };
});
然后$ firebase deploy --only functions
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.