本文介绍了无法在Firebase控制台中显示已部署的云功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已尝试将云功能部署到Firebase,但我感到困惑在命令提示符和Firebase控制台->项目->功能之间.因为在命令提示符下显示已成功部署,但在功能标签中没有任何功能.

I have try to deploy cloud function to firebase but i am confusedbetween command prompt and firebase console->project->functions.Because in command prompt display deployed successfully but infunction tab there is no any functions.

我已按照以下步骤进行了部署

I have follow below steps for deploy process

  1. 下载一个示例函数并将其放置在文件夹名为AddMessage的c驱动器中.
  2. 启动命令提示符并运行"npm install -g firebase-tools"命令.
  3. 之后,我运行了"firebase login"命令,结果是您已经使用电子邮件登录.
  4. 之后,我运行了"firebase init functions"命令,并给了我项目列表,并选择了一个带有enter.的项目.并回答了图像中的某些问题.

  1. Download a sample function and place to c drive with folder name AddMessage.
  2. Start command prompt and run "npm install -g firebase-tools"command.
  3. After that i have run "firebase login" command and result is you have already logged in with email.
  4. After that i have run "firebase init functions" command and give me project list and i have select a project with enter.And answer to some question that is in image.

5.之后,我运行"firebase deploy --only functions"命令.并给我以下结果.

5.After that i have run "firebase deploy --only functions" command.and give me below result.

此后,我访问了 https://console.firebase.google.com/在检查选定的项目->功能,但我得到了下面的屏幕.

After that i have visit to https://console.firebase.google.com/ in check in selected project -> function but i got below screen.

推荐答案

Firebase仅部署导出的功能,因此,您必须确保要部署的功能已导出到index.js文件中:

Firebase only deploys functions that are exported,so you have to make sure that the function you want to deploy is exported in your index.js file:

exports.yourFunction = functions.https.onRequest((req, res) => {
// Your enter code here
}

这篇关于无法在Firebase控制台中显示已部署的云功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 11:03