部署时Firebase CLI忽略我的云功能

ruarlubt  于 2022-11-17  发布在  其他
关注(0)|答案(2)|浏览(130)

我在index.ts中定义了云函数。但是,当尝试使用firebase deploy部署我的云函数时,Firebase CLI没有检测到我的函数。
端子输出

✔  functions: Finished running predeploy script.
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  artifactregistry: required API artifactregistry.googleapis.com is enabled
i  functions: preparing codebase default for deployment
i  functions: preparing cloud_functions directory for uploading...
i  functions: packaged /Users/nils/cloud_functions (243.98 KB) for uploading
✔  functions: cloud_functions folder uploaded successfully
i  functions: cleaning up build files...

✔  Deploy complete!

我的index.ts

import { submitFunction } from "./features/submit/submit_function";

我的submit_function.ts
第一次

yhived7q

yhived7q1#

Firebase CLI仅查看顶级导出函数,并且index.js文件函数中唯一的顶级函数与任何Cloud Functions触发器的签名都不匹配。
你在找这个吗?

exports.submitFunction = functions.https.onRequest(async (req, response) => {
  response.status(200);
});
afdcj2ne

afdcj2ne2#

问题是submitFunction函数是async
将您的submitFunction

export async function submitFunction() {
  return functions.https.onRequest(async (req, response) => {
    response.status(200);
  });
}

export function submitFunction() {
  return functions.https.onRequest(async (req, response) => {
    response.status(200);
  });
}

相关问题