我正在构建一个Rails应用程序,我使用dynamoDB作为数据库(使用dynamoid)。当我运行测试时,我得到以下错误: Aws::Errors::MissingCredentialsError:unable to sign request without credentials set 由于测试是在本地dynamoDB中运行的,所以我对这个错误消息有点困惑。是不是我的测试没有在本地数据库中运行,而他们正在尝试访问远程数据库?
# Consumed by AWS Cognito under the hood. Required. A.k.a. client ID.
AWS_ACCESS_KEY_ID = "xxxxxxxxxxxxxxxxxx"
# Consumed by AWS Cognito under the hood. Required. A.k.a. client secret.
AWS_SECRET_ACCESS_KEY = "xxxxxxxxxxxxxxxxxxx"
2条答案
按热度按时间vltsax251#
您可以使用下面的本地dynamodb配置。当您给予localhost端点时,dynamodb直接使用该端点,而不是从region派生端点。
该区域用于构造SSL端点。如果需要连接到非标准端点,可以指定:endpoint选项。
llycmphe2#
在我的例子中,我只是缺少设置2个env变量,如官方文档中所述:https://github.com/aws/aws-sdk-ruby#configuration
在我设置这些之后,一切都工作了: