Laravel 5.1 Amazon SQS:Exception SignatureDoesNotMatch签名已过期

时间:2015-10-20 10:37:42

标签: exception laravel-5.1 amazon-sqs

我已经使用Amazon SQS在Laravel 5.1中配置了队列,并且它第一次正常工作但之后却出现以下错误:

  

"执行\" SendMessage \"时出错on \" queue_url \&#34 ;; AWS HTTP错误:   客户端错误:403 SignatureDoesNotMatch(客户端):签名已过期:   20151019T195353Z现在早于20151020T101301Z   (20151020T102801Z - 15分钟。) - 发件人SignatureDoesNotMatch签名   已过期:20151019T195353Z现在早于20151020T101301Z   (20151020T102801Z - 15   分钟)"

似乎正在不断使用与请求关联的时间戳。如何在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',
    ],

1 个答案:

答案 0 :(得分:2)

由于我的debian机器上设置了错误的日期时间而发生错误。我已经更改了时区并更正了日期时间,并且工作正常。

date --set 1998-11-02 
date --set 21:08:00

自动设定时间

apt-get install ntp

https://wiki.debian.org/DateTime#Set_the_time_automatically

Laravel 5 Amazon AWS S3 Error: Client error: 403 RequestTimeTooSkewed