gpt4 book ai didi

javascript - 为什么 firebase 函数 onCall 不部署?

转载 作者:行者123 更新时间:2023-12-01 01:27:10 26 4
gpt4 key购买 nike

我在index.ts中有 typescript 代码

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

我回来了:

functions: the following filters were specified but do not match any functions in the project: myFunc

我做错了什么?

最佳答案

我发现了一个错误。 Typescript 编译目录 lib/functions/src/index.js 中的 .js 文件,但我的 package.json 文件具有主文件的外部路径

{
...
"main": "lib/index.js",
...
}

我改为

{
...
"main": "lib/functions/src/index.js",
...
}

成功了!

关于javascript - 为什么 firebase 函数 onCall 不部署?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53672861/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com