【问题标题】:DialogFlow external api calling - result is always object Object [duplicate]DialogFlow 外部 api 调用 - 结果始终是对象 Object [重复]
【发布时间】:2020-09-12 01:21:35
【问题描述】:

下面是 index.js 中的方法

function costOfItemHandler(agent) {
    const itemName = agent.parameters.foodItem;
    const url = "https://fast-beach-13460.herokuapp.com/Eatery";
    return axios.get(url)
        .then((result) => {
            console.log('result is '+ result);   
        });

在日志中出现 textPayload:“result is [object Object]”。 当我浏览网址时,它会给出正确的响应。

【问题讨论】:

  • 函数在哪里调用
  • 在 dialogflow 内联编辑器中。

标签: javascript node.js firebase dialogflow-es dialogflow-es-fulfillment


【解决方案1】:

试试这个:

console.log('result is ', result);

如果将对象附加到字符串,则返回 [object, Object]。

【讨论】:

    猜你喜欢
    • 2018-03-28
    • 2012-02-22
    • 1970-01-01
    • 1970-01-01
    • 2011-01-21
    • 2012-11-03
    • 2019-07-28
    • 2017-02-20
    • 1970-01-01
    相关资源
    最近更新 更多