我有一个Lex Bot设置,可以很好地使用Android。但当我试图从react native访问相同的内容时,我会得到以下错误:
NotFoundException: There is no alias named test for the bot named test_bot_name. Choose another alias.
我使用的是aws-sdk-react本机包。我给Lex的电话是这样的:
sendToLex(message) {
let params = {
botAlias: 'test',
botName: 'test_bot_name',
inputText: message,
userId: lexUserId,
}
lexRunTime.postText(params, (err, data) => {
if(err) {
// TODO SHOW ERROR ON MESSAGES
console.log("[ERROR] Error: " + err);
console.log("[ERROR] Data: " + data);
}
if (data) {
console.log("Data " + data);
this.showResponse(data)
}
})
}
相同的botAlias和botName参数在Android上运行良好。但对react native不起作用。AWS配置凭据看起来很好,因为我没有收到与身份池和区域相关的错误。
如果它确实像你说的那样在Android中工作,那么我建议如下:-
- 确保凭据用于正确的帐户
- 确保指向正确的区域
尝试创建另一个别名并进行测试,以减少系统中的任何搞笑内容。