问题描述
我有一个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-native软件包。我打给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上可以正常使用。但是对本地反应不起作用。 AWS config凭证看起来不错,因为我没有收到与身份池和区域有关的错误。
解决方法
如果您所说的确实可以在Android中运行,那么我建议以下内容:-
- 确保凭据用于正确的帐户
- 确保您指向的区域正确
尝试创建另一个别名,并进行测试以降低系统中的所有功能。