【问题标题】:"TypeError: Cannot read property 'fulfillmentMessages' of undefined"“TypeError:无法读取未定义的属性‘fulfillmentMessages’”
【发布时间】:2021-08-09 04:13:51
【问题描述】:

我正在尝试将 Dialogflow 集成到 React Native,我遵循了 this 教程

但是,我遇到了这个错误。

下面是导致错误的我的 handleGoogleResponse

handleGoogleResponse(result) {
    let text = result.queryResult.fulfillmentMessages[0].text.text[0]; //error
    this.sendBotResponse(text);
  }

我希望你能帮我解决这个问题。非常感谢。

【问题讨论】:

  • 尝试通过console.log(JSON.stringify(result)) 打印result 的内容,这样您就可以看到更好的错误消息。

标签: javascript node.js reactjs react-native dialogflow-es-fulfillment


【解决方案1】:

它说 queryResult 是未定义的, 检查您是否正确配置了 Firebase。

显示内部代码

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-24
    • 2019-08-19
    • 1970-01-01
    相关资源
    最近更新 更多