问题描述
我正在为 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 (将#修改为@)