0
votes

In my client server, I send queue to AWS SQS using Artisan::queue. In .env file I configured QUEUE_DRIVER=sqs and in config/queue.php file I configured like below.

'default' => env('QUEUE_DRIVER', 'sqs'),

'sqs' => [
        'driver' => 'sqs',
        'key' => 'MY_AWS_KEY',
        'secret' => 'MY_AWS_SECRET',
        'prefix' => 'https://sqs.us-west-2.amazonaws.com/1234567890',
        'queue' => 'queue-name',
        'region' => 'us-west-2',
    ],

Now when I call Artisan::queue from Controller I see message is created in SQS. I can see them in AWS console and they are like below.

{"job":"Illuminate\\Foundation\\Console\\QueuedJob",
 "data":[{"some_data_key":"some_data_value"}]}

Everything is fine so far I believe. But my worker tier never receives data. I have configured in Worker tier>Configuration>Worker Details like below:

Worker queue: queue-name
Worker queue URL: https://sqs.us-west-2.amazonaws.com/1234567890/queue-name
HTTP path: /worker

Here, my problem is that I always get 404 error on /worker address. As soon as message was sent, I see one count up in "Messages in Flight" in AWS SQS console and when I check Worker tier's log file, I see bunch of

`127.0.0.1 (-) - - [28/Jun/2017:08:37:10 +0000] "POST /worker HTTP/1.1" 404 204 "-" "aws-sqsd/2.3"`

I checked if post request to /worker returned error but it works okay in different server (I couldn't check in worker tier as I don't have URL address for it). At this point, Worker tier server has only

Route::match(['GET', 'POST'], 'worker', function () {
    return 200;
});

in routes/web.php to see if POST request could reach there.

What did I do wrong? Did I miss something? Or implement it in wrong way?

1

1 Answers

0
votes

If your are using your worker environment in elastic beanstalk, make sure your

Configuration->Software Configuration->Container Option->Document Root

is set to value

/public

Also check your route provider somewhere like

app/Providers/RouteServiceProvider.php

There check map() function to see if you are creating your http routes to appropriate file. There can be reference to multiple route files like web.php and api.php etc