【问题标题】:Google assistant action, no function URL谷歌助手操作,无功能网址
【发布时间】:2019-04-30 10:24:26
【问题描述】:

我想创建一个行动项目。我在运行firebase deploy --only functions 时遇到问题。

在我跑步之前:npm install -g firebase-toolsfirebase loginfirebase initnpm install actions-on-googlenpm install

一切正常,并显示:部署完成。但它没有向我提供 CMD 中的函数 URL。另外,当我在这里查找时:https://console.firebase.google.com/.../functions/list 它没有显示 URL。

你知道我做错了什么吗? 这就是我正在做的教程: https://developers.google.com/actions/tools/fulfillment-hosting

最好的问候 卢卡

【问题讨论】:

  • 你能发布你的代码吗?
  • 我还没有任何代码。我的 index.js 只包含 const functions = require('firebase-functions');
  • 您需要先定义一个 HTTP 函数,然后部署才会给您一个 url。您不能部署“无”并期望创建某些内容。

标签: google-cloud-functions dialogflow-es actions-on-google firebase-cli


【解决方案1】:

您需要导出一个函数,否则 Firebase 无法运行/部署它。您可以查看一些很棒的代码示例,了解如何使用 Firebase here 在 Google 助理上进行操作。

以下代码应该可以帮助您入门。

const {dialogflow} = require('actions-on-google');
const functions = require('firebase-functions');

const app = dialogflow({debug: true});


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

【讨论】:

    猜你喜欢
    • 2018-07-13
    • 2017-11-30
    • 2022-01-11
    • 2018-11-03
    • 1970-01-01
    • 1970-01-01
    • 2015-12-04
    • 1970-01-01
    • 2021-05-01
    相关资源
    最近更新 更多