在本地开发 Alexa 技能时出现 Dynamo 错误“ConfigError: Missing region in config”

Joh*_*vie 5 node.js amazon-dynamodb aws-lambda alexa-skills-kit

使用Bespoken Tools在本地开发和调试 Alexa 技能时,连接到 Dynamo(使用Alexa Node.js SDK)时发生错误。

该错误发生在 Alexa SDK 中对Dynamo“get”调用中

Joh*_*vie 5

发生此错误的原因~/.aws/config是 Node.js SDK for AWS 未正确识别 中设置的区域。

要解决此问题,只需显式调用配置区域,如下所示:

AWS.config.update({
    region: "us-east-1"
});
Run Code Online (Sandbox Code Playgroud)

在使用 alexa-sdk 处理任何事件之前,即在调用alexa.execute().