即使已在 AWS SQS PHP SDK 中提供,也会出现缺少参数错误
Missing parameter error even if already provided in AWS SQS PHP SDK
即使我已经提供了 MessageGroupId
参数,我仍然收到此错误:
AWS HTTP error: Client error: POST https://sqs.us-west-2.amazonaws.com/xxx/xxx.fifo
resulted in a 400 Bad Request
response: SenderM (truncated...) MissingParameter (client): The request must contain the parameter MessageGroupId. - SenderMissingParameterThe request must contain the parameter MessageGroupId ...
这是一个示例代码:
$client = new Aws\Sqs\SqsClient([
'region' => 'us-west-2',
'version' => '2012-11-05',
'MessageGroupId' => 'testGroup',
'credentials' => [
'key' => 'xxx',
'secret' => 'xxx'
]
]);
$params = [
'MessageBody' => 'foo',
'QueueUrl' => 'https://sqs.us-west-2.amazonaws.com/xxx/xxx.fifo'
];
try {
$result = $client->sendMessage($params);
var_dump($result);
} catch (Aws\Exception\AwsException $e) {
echo $e->getMessage();
}
不知道为什么我把 MessageGroupId
放在 SqsClient()
参数中,而它应该放在 sendMessage()
$params
数组中。
即使我已经提供了 MessageGroupId
参数,我仍然收到此错误:
AWS HTTP error: Client error:
POST https://sqs.us-west-2.amazonaws.com/xxx/xxx.fifo
resulted in a400 Bad Request
response: SenderM (truncated...) MissingParameter (client): The request must contain the parameter MessageGroupId. - SenderMissingParameterThe request must contain the parameter MessageGroupId ...
这是一个示例代码:
$client = new Aws\Sqs\SqsClient([
'region' => 'us-west-2',
'version' => '2012-11-05',
'MessageGroupId' => 'testGroup',
'credentials' => [
'key' => 'xxx',
'secret' => 'xxx'
]
]);
$params = [
'MessageBody' => 'foo',
'QueueUrl' => 'https://sqs.us-west-2.amazonaws.com/xxx/xxx.fifo'
];
try {
$result = $client->sendMessage($params);
var_dump($result);
} catch (Aws\Exception\AwsException $e) {
echo $e->getMessage();
}
不知道为什么我把 MessageGroupId
放在 SqsClient()
参数中,而它应该放在 sendMessage()
$params
数组中。