gpt4 book ai didi

php - 亚马逊 DynamoDB InvalidSignatureException

转载 作者:IT王子 更新时间:2023-10-29 01:09:23 24 4
gpt4 key购买 nike

从这段代码中我得到了下面的错误

require "vendor/autoload.php";
use Aws\Common\Aws;
use Aws\DynamoDb\DynamoDbClient;
use Aws\DynamoDb\Enum\ComparisonOperator;
use Aws\DynamoDb\Enum\KeyType;
use Aws\DynamoDb\Enum\Type;

$aws = Aws::factory(array(
'key' => '[clipped]',
'secret' => '[clipped]',
'region' => Region::US_WEST_1
));

$client = $aws->get("dynamodb");
$tableName = "ExampleTable";

$result = $client->createTable(array(
"TableName" => $tableName,
"AttributeDefinitions" => array(
array(
"AttributeName" => "Id",
"AttributeType" => Type::NUMBER
)
),
"KeySchema" => array(
array(
"AttributeName" => "Id",
"KeyType" => KeyType::HASH
)
),
"ProvisionedThroughput" => array(
"ReadCapacityUnits" => 5,
"WriteCapacityUnits" => 6
)
));

print_r($result->getPath('TableDescription'));

尝试将表添加到 AWS 的 DynamoDB 时出现以下错误。

PHP Fatal error:  Uncaught Aws\\DynamoDb\\Exception\\DynamoDbException: AWS Error Code:
InvalidSignatureException,
Status Code: 400,
AWS Request ID: [clipped],
AWS Error Type: client,
AWS Error Message: Signature expired: 20130818T021159Z is now earlier than
20130818T021432Z (20130818T022932Z - 15 min.),
User-Agent: aws-sdk-php2/2.4.3 Guzzle/3.7.2 curl/7.21.6 PHP/5.3.6-13ubuntu3.9\n thrown in
/var/www/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php on
line 91

到目前为止,我已经:

  • 检查了 Authentication Key 和 Secret Key 是否正确。
  • 更新 cURL
  • 当我输入错误的身份验证权限时,错误并没有改变。

最佳答案

看来您的本地系统时间可能不正确。我在 AWS S3 上遇到过类似的问题,我的系统时钟偏移了 30 分钟。

如果您运行的是 ubuntu,请尝试更新您的系统时间:

sudo ntpdate ntp.ubuntu.com

关于php - 亚马逊 DynamoDB InvalidSignatureException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18295185/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com