【问题标题】:Firebase deploy not giviing a webhook URLFirebase 部署未提供 webhook URL
【发布时间】:2021-03-09 07:50:10
【问题描述】:

我正在使用 Dialogflow 为 Google 助理创建一个操作。我正在关注本教程:https://medium.com/voice-tech-podcast/get-current-location-of-a-user-using-helper-intents-in-actions-on-google-19fe9a8ea99f

当我在第 5 步中使用命令 firebase deploy 时,得到的输出如下:

=== Deploying to 'location-tracker-xxxx'...

i  deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint .

✔  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...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing functions directory for uploading...

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/location-tracker-xxxx/overview

我应该获得可以在 Dialogflow 中用作 webhook URL 的 Webhook URL。

这是我的 index.js:

const functions = require("firebase-functions");
const { dialogflow, Permission, SimpleResponse } = require("actions-on-google");

const app = dialogflow();

app.intent("Default Welcome Intent", conv => {
    conv.data.requestedPermission = "DEVICE_PRECISE_LOCATION";
    conv.ask(new SimpleResponse('Welcome to location tracker'));
    return conv.ask(
      new Permission({
        context: "to locate you",
        permissions: conv.data.requestedPermission
      })
    );
  });

我已阅读此Stackoverflow,但它并没有解决我的问题,因为没有显示解决方案是科学的,所引用的代码不再可用。

谢谢!

【问题讨论】:

  • 没有部署任何函数,因为您从未定义和导出过任何函数。仅定义对话流应用程序是不够的。
  • 您好,Doug,感谢您的回答!我还是很菜鸟,应该怎么定义?
  • @DougStevenson 我尝试了几件事,但仍然无法正常工作..

标签: javascript google-cloud-functions dialogflow-es actions-on-google dialogflow-es-fulfillment


【解决方案1】:

正如 Doug 在 cmets 中提到的那样,您需要确保在代码中导出了一个函数。这个可以加到底部:

exports.ActionsOnGoogleFulfillment = functions.https.onRequest(app);

ActionsOnGoogleFulfillment 是您的函数的名称。当您运行该命令时,它将被部署。

您可以在 Firebase 控制台中查看所有函数,并且您应该期望它采用以下格式:

https://us-central1-**PROJECT_ID**.cloudfunctions.net/**FUNCTION_NAME**

【讨论】:

    猜你喜欢
    • 2019-07-13
    • 1970-01-01
    • 2018-07-11
    • 1970-01-01
    • 1970-01-01
    • 2021-01-31
    • 2021-03-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多