在 actions-on-google 中获取用户信息时出错

问题描述

我正在为 Google 助理开发一个应用程序,但总是在我尝试获取用户信息(例如姓名或位置)时,在获得用户权限后应用程序崩溃,并且在下次启动应用程序时授予的权限在同一步骤中再次崩溃。

app.handle('create_user',async (conv) => {
  const payload = conv.user.params.tokenPayload;
  // write user name in session to use in dialogs
  conv.user.params.name = payload.given_name;
  const email = payload.email;
  if (email) {
    try {
      conv.user.params.uid = (await auth.getUserByEmail(email)).uid;
    } catch (e) {
      if (e.code !== 'auth/user-not-found') {
        throw e;
      }
      // If the user is not found,create a new Firebase auth user
      // using the email obtained from the Google Assistant
      conv.user.params.uid = (await auth.createuser({email})).uid;
    }
    const userDoc = dbs.user.doc(conv.user.params.uid);
    const orderHistoryColl = userDoc.collection(orderHistory);
    for (let i = 0; i < options.length; i++) {
      await orderHistoryColl.doc(options[i]).set(
          {option: options[i],count: 0});
    }
  }
});

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...