Laravel 5.1 Amazon SQS:异常 SignatureDoesNotMatch 签名已过期
Laravel 5.1 Amazon SQS: Exception SignatureDoesNotMatch Signature expired
我使用 Amazon SQS 在 Laravel 5.1 中配置了队列,它第一次运行良好,但之后出现以下错误:
"Error executing \"SendMessage\" on \"queue_url\"; AWS HTTP error:
Client error: 403 SignatureDoesNotMatch (client): Signature expired:
20151019T195353Z is now earlier than 20151020T101301Z
(20151020T102801Z - 15 min.) - SenderSignatureDoesNotMatch
Signature
expired: 20151019T195353Z is now earlier than 20151020T101301Z
(20151020T102801Z - 15
min.)"
似乎一直在使用与请求关联的时间戳。如何在 Laravel 中配置它?
按照我排队测试邮件的方式:
/**
* Send an e-mail reminder to the user.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function sendEmailReminder(Request $request, $id)
{
$user = User::findOrFail($id);
// $this->dispatch(new SendReminderEmail($user));
try {
Mail::queue('emails.reminder', ['user' => $user], function ($m) use ($user) {
$m->to($user->email, $user->name)->subject('Your Reminder!');
});
} catch (Exception $ex) {
throw ($ex);
}
}
配置:
'sqs' => [
'driver' => 'sqs',
'key' => 'key',
'secret' => 'secret',
'queue' => 'https://sqs.us-east-1.amazonaws.com/xxxx/jobs[queue_name]',
'region' => 'us-east-1',
],
错误是由于我的 debian 机器上设置的日期时间错误造成的。我更改了时区并更正了日期时间,它工作正常。
date --set 1998-11-02
date --set 21:08:00
自动设置时间
apt-get install ntp
https://wiki.debian.org/DateTime#Set_the_time_automatically
我使用 Amazon SQS 在 Laravel 5.1 中配置了队列,它第一次运行良好,但之后出现以下错误:
"Error executing \"SendMessage\" on \"queue_url\"; AWS HTTP error: Client error: 403 SignatureDoesNotMatch (client): Signature expired: 20151019T195353Z is now earlier than 20151020T101301Z (20151020T102801Z - 15 min.) - Sender
SignatureDoesNotMatch
Signature expired: 20151019T195353Z is now earlier than 20151020T101301Z (20151020T102801Z - 15 min.)"
似乎一直在使用与请求关联的时间戳。如何在 Laravel 中配置它?
按照我排队测试邮件的方式:
/**
* Send an e-mail reminder to the user.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function sendEmailReminder(Request $request, $id)
{
$user = User::findOrFail($id);
// $this->dispatch(new SendReminderEmail($user));
try {
Mail::queue('emails.reminder', ['user' => $user], function ($m) use ($user) {
$m->to($user->email, $user->name)->subject('Your Reminder!');
});
} catch (Exception $ex) {
throw ($ex);
}
}
配置:
'sqs' => [
'driver' => 'sqs',
'key' => 'key',
'secret' => 'secret',
'queue' => 'https://sqs.us-east-1.amazonaws.com/xxxx/jobs[queue_name]',
'region' => 'us-east-1',
],
错误是由于我的 debian 机器上设置的日期时间错误造成的。我更改了时区并更正了日期时间,它工作正常。
date --set 1998-11-02
date --set 21:08:00
自动设置时间
apt-get install ntp
https://wiki.debian.org/DateTime#Set_the_time_automatically