Coder Social home page Coder Social logo

laravel-aws-worker's Introduction

laravel-aws-worker

Code Climate Total Downloads Latest Stable Version Latest Unstable Version License

Run Laravel tasks and queue listeners inside of AWS Elastic Beanstalk workers

We've dropped future support for Lumen, however you can still use v0.1.40 for Lumen.

Overview

Laravel documentation recommends to use supervisor for queue workers and *IX cron for scheduled tasks. However, when deploying your application to AWS Elastic Beanstalk, neither option is available.

This package helps you run your Laravel jobs in AWS worker environments.

Standard Laravel queue flow AWS Elastic Beanstalk flow

Dependencies

  • PHP >= 5.5
  • Laravel >= 5.1

Scheduled tasks - option 1

Option one is to use Kernel.php as the schedule and run Laravel schedule runner every minute. You remember how Laravel documentation advised you to invoke the task scheduler? Right, by running php artisan schedule:run on regular basis, and to do that we had to add an entry to our cron file:

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

AWS doesn't allow you to run *IX commands or to add cron tasks directly. Instead, you have to make regular HTTP (POST, to be precise) requests to your worker endpoint.

Add cron.yaml to the root folder of your application (this can be a part of your repo or you could add this file right before deploying to EB - the important thing is that this file is present at the time of deployment):

version: 1
cron:
 - name: "schedule"
   url: "/worker/schedule"
   schedule: "* * * * *"

From now on, AWS will do POST /worker/schedule to your endpoint every minute - kind of the same effect we achieved when editing a UNIX cron file. The important difference here is that the worker environment still has to run a web process in order to execute scheduled tasks. Behind the scenes it will do something very similar to a built-in schedule:run command.

Your scheduled tasks should be defined in App\Console\Kernel::class - just where they normally live in Laravel, eg.:

protected function schedule(Schedule $schedule)
{
    $schedule->command('inspire')
              ->everyMinute();
}

Scheduled tasks - option 2

Option two is to use AWS schedule defined in the cron.yml:

version: 1
cron:
 - name: "run:command"
   url: "/worker/schedule"
   schedule: "0 * * * *"

 - name: "do:something --param=1 -v"
   url: "/worker/schedule"
   schedule: "*/5 * * * *"

Note that AWS will use UTC timezone for cron expressions. With the above example, AWS will hit /worker/schedule endpoint every hour with run:command artisan command and every 5 minutes with do:something command. Command parameters aren't supported at this stage.

Pick whichever option is better for you!

Queued jobs: SQS

Normally Laravel has to poll SQS for new messages, but in case of AWS Elastic Beanstalk messages will come to us – inside of POST requests from the AWS daemon.

Therefore, we will create jobs manually based on SQS payload that arrived, and pass that job to the framework's default worker. From this point, the job will be processed the way it's normally processed in Laravel. If it's processed successfully, our controller will return a 200 HTTP status and AWS daemon will delete the job from the queue. Again, we don't need to poll for jobs and we don't need to delete jobs - that's done by AWS in this case.

If you dispatch jobs from another instance of Laravel or if you are following Laravel's payload format {"job":"","data":""} you should be okay to go. If you want to receive custom format JSON messages, you may want to install Laravel plain SQS package as well.

Configuring the queue

Every time you create a worker environment in AWS, you are forced to choose two SQS queues – either automatically generated ones or some of your existing queues. One of the queues will be for the jobs themselves, another one is for failed jobs – AWS calls this queue a dead letter queue.

You can set your worker queues either during the environment launch or anytime later in the settings:

AWS Worker queue settings

Don't forget to set the HTTP path to /worker/queue – this is where AWS will hit our application. If you chose to generate queues automatically, you can see their details later in SQS section of the AWS console:

AWS SQS details

You have to tell Laravel about this queue. First set your queue driver to SQS in .env file:

QUEUE_DRIVER=sqs

Then go to config/queue.php and copy/paste details from AWS console:

        ...
        'sqs' => [
            'driver' => 'sqs',
            'key' => 'your-public-key',
            'secret' => 'your-secret-key',
            'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id',
            'queue' => 'your-queue-name',
            'region' => 'us-east-1',
        ],
        ...

To generate key and secret go to Identity and Access Management in the AWS console. It's better to create a separate user that ONLY has access to SQS.

Installation via Composer

To install simply run:

composer require dusterio/laravel-aws-worker

Or add it to composer.json manually:

{
    "require": {
        "dusterio/laravel-aws-worker": "~0.1"
    }
}

Usage in Laravel 5

// Add in your config/app.php

'providers' => [
    '...',
    'Dusterio\AwsWorker\Integrations\LaravelServiceProvider',
];

After adding service provider, you should be able to see two special routes that we added:

$ php artisan route:list
+--------+----------+-----------------+------+----------------------------------------------------------+------------+
| Domain | Method   | URI             | Name | Action                                                   | Middleware |
+--------+----------+-----------------+------+----------------------------------------------------------+------------+
|        | POST     | worker/queue    |      | Dusterio\AwsWorker\Controllers\WorkerController@queue    |            |
|        | POST     | worker/schedule |      | Dusterio\AwsWorker\Controllers\WorkerController@schedule |            |
+--------+----------+-----------------+------+----------------------------------------------------------+------------+

Environment variable REGISTER_WORKER_ROUTES is used to trigger binding of the two routes above. If you run the same application in both web and worker environments, don't forget to set REGISTER_WORKER_ROUTES to false in your web environment. You don't want your regular users to be able to invoke scheduler or queue worker.

This variable is set to true by default at this moment.

So that's it - if you (or AWS) hits /worker/queue, Laravel will process one queue item (supplied in the POST). And if you hit /worker/schedule, we will run the scheduler (it's the same as to run php artisan schedule:run in shell).

Usage in Lumen 5

// Add in your bootstrap/app.php
$app->register(Dusterio\AwsWorker\Integrations\LumenServiceProvider::class);

Errors and exceptions

Please make sure that two special routes are not mounted behind a CSRF middleware. Our POSTs are not real web forms and CSRF is not necessary here. If you have a global CSRF middleware, add these routes to exceptions, or otherwise apply CSRF to specific routes or route groups.

If your job fails, we will throw a FailedJobException. If you want to customize error output – just customise your exception handler. Note that your HTTP status code must be different from 200 in order for AWS to realize the job has failed.

Job expiration (retention)

A new nice feature is being able to set a job expiration (retention in AWS terms) in seconds so that low value jobs get skipped completely if there is temporary queue latency due to load.

Let's say we have a spike in queued jobs and some of them don't even make sense anymore now that a few minutes passed – we don't want to spend computing resources processing them later.

By setting a special property on a job or a listener class:

class PurgeCache implements ShouldQueue
{
    public static int $retention = 300; // If this job is delayed more than 300 seconds, skip it
}

We can make sure that we won't run this job later than 300 seconds since it's been queued. This is similar to AWS SQS "message retention" setting which can only be set globally for the whole queue.

To use this new feature, you have to use provided Jobs\CallQueuedHandler class that extends Laravel's default CallQueuedHandler. A special ExpiredJobException exception will be thrown when expired jobs arrive and then it's up to you what to do with them.

If you just catch these exceptions and therefore stop Laravel from returning code 500 to AWS daemon, the job will be deleted by AWS automatically.

ToDo

  1. Add support for AWS dead letter queue (retry jobs from that queue?)

Video tutorials

I've just started a educational YouTube channel that will cover top IT trends in software development and DevOps: config.sys

Also I'm glad to announce a new cool tool of mine – GrammarCI, an automated typo/grammar checker for developers, as a part of the CI/CD pipeline.

Implications

Note that AWS cron doesn't promise 100% time accuracy. Since cron tasks share the same queue with other jobs, your scheduled tasks may be processed later than expected.

Post scriptum

I wrote a blog post explaining how this actually works.

laravel-aws-worker's People

Contributors

cyberduckneil avatar d3radicated avatar dclaysmith avatar dusterio avatar fylzero avatar gcg avatar gilbitron avatar gtlkirit avatar laravel-shift avatar mccahan avatar nadge avatar organiseio avatar pushpak avatar sensetivity avatar timmylindh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-aws-worker's Issues

Issue with WithoutOverLapping and Max tries

I have two issues with my worker. How can I solve these two issues?

1. WithoutOverLapping:
Ex: I have One job which runs every 5 mins. But sometimes the job might take more than 5 mins. In order to avoid multiple overlapping jobs, Laravel has a WithoutOverLapping concept. It is not working ( not even triggering the job) with the package. Is there any workaround? Or any plans to add support?

$schedule
            ->command('test:command')
            ->everyFiveMinutes()
            ->withoutOverlapping();

2. MaxTries: It seems that there is an existing issue. I saw a PR which is not released yet. Any plan to add this support?

Maximum function nesting level reached on Lumen 5.4.5

Hi,

After an update of my composer dependencies (Lumen 5.4.5 and others), it appears that laravel-aws-worker library does not work anymore.

Homestead result

I tried to simulate (including headers and body as expected) the behavior of the SQS and the response leads into the Maximum function nesting level reached:

XDebug disabled

Fatal error: Maximum function nesting level of '512' reached, aborting! in /home/vagrant/my-project/vendor/illuminate/container/Container.php on line 645

Fatal error: Maximum function nesting level of '512' reached, aborting! in /home/vagrant/my-project/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php on line 53

XDebug enabled

( ! ) Fatal error: Maximum function nesting level of '512' reached, aborting! in /home/vagrant/my-project/vendor/illuminate/container/Container.php on line 645
Call Stack
#	Time	Memory	Function	Location
1	0.0005	361280	{main}( )	.../index.php:0
2	0.1322	1138112	Laravel\Lumen\Application->run( )	.../index.php:28
3	0.1322	1138112	Laravel\Lumen\Application->dispatch( )	.../RoutesRequests.php:475
4	0.1326	1155256	Laravel\Lumen\Application->sendThroughPipeline( )	.../RoutesRequests.php:534
5	0.1367	1157752	Illuminate\Pipeline\Pipeline->then( )	.../RoutesRequests.php:778
6	0.1367	1159144	Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}( )	.../Pipeline.php:102
7	0.1367	1160160	call_user_func:{/home/vagrant/my-project/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:32} ( )	.../Pipeline.php:32
8	0.1367	1160160	Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}( )	.../Pipeline.php:32
9	0.1396	1161608	Vluzrmos\LumenCors\CorsMiddleware->handle( )	.../Pipeline.php:148
10	0.1396	1161984	Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}( )	.../CorsMiddleware.php:43
11	0.1396	1161984	call_user_func:{/home/vagrant/my-project/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:52} ( )	.../Pipeline.php:52
12	0.1396	1161984	Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}( )	.../Pipeline.php:52
13	0.1396	1162360	Laravel\Lumen\Application->handleFoundRoute( )	.../RoutesRequests.php:528
14	0.1396	1162360	Laravel\Lumen\Application->callActionOnArrayBasedRoute( )	.../RoutesRequests.php:628
15	0.1396	1162360	Laravel\Lumen\Application->callControllerAction( )	.../RoutesRequests.php:643
16	0.1433	1230752	Laravel\Lumen\Application->callControllerCallable( )	.../RoutesRequests.php:684
17	0.1433	1230752	Illuminate\Container\Container->call( )	.../RoutesRequests.php:741
18	0.1433	1230752	Illuminate\Container\BoundMethod::call( )	.../Container.php:524
19	0.1433	1231448	Illuminate\Container\BoundMethod::callBoundMethod( )	.../BoundMethod.php:30
20	0.1434	1231528	value( )	.../BoundMethod.php:86
21	0.1434	1231528	Illuminate\Container\BoundMethod::Illuminate\Container\{closure}( )	.../helpers.php:912
22	0.1617	1243064	call_user_func_array:{/home/vagrant/my-project/vendor/illuminate/container/BoundMethod.php:28} ( )	.../BoundMethod.php:28
23	0.1617	1243112	Dusterio\AwsWorker\Controllers\WorkerController->queue( )	.../BoundMethod.php:28
24	0.1674	1248472	Dusterio\AwsWorker\Wrappers\Laravel53Worker->process( )	.../WorkerController.php:83
25	0.1682	1249368	Illuminate\Queue\Worker->process( )	.../Laravel53Worker.php:33
26	0.1694	1250040	Dusterio\AwsWorker\Jobs\AwsJob->fire( )	.../Worker.php:291
27	0.1694	1250040	Illuminate\Queue\Jobs\Job->fire( )	.../AwsJob.php:46
28	0.1759	1260488	Illuminate\Queue\CallQueuedHandler->call( )	.../Job.php:69
29	0.1819	1289000	Illuminate\Bus\Dispatcher->dispatchNow( )	.../CallQueuedHandler.php:42
30	0.1819	1289320	Illuminate\Pipeline\Pipeline->then( )	.../Dispatcher.php:98
31	0.1819	1290016	Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}( )	.../Pipeline.php:102
32	0.1819	1290016	Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}( )	.../Pipeline.php:114
33	0.1819	1290392	Illuminate\Container\Container->call( )	.../Dispatcher.php:94
34	0.1819	1290392	Illuminate\Container\BoundMethod::call( )	.../Container.php:524
35	0.1819	1291088	Illuminate\Container\BoundMethod::callBoundMethod( )	.../BoundMethod.php:30
36	0.1819	1291168	value( )	.../BoundMethod.php:86
37	0.1819	1291168	Illuminate\Container\BoundMethod::Illuminate\Container\{closure}( )	.../helpers.php:912
38	0.1819	1291168	Illuminate\Container\BoundMethod::getMethodDependencies( )	.../BoundMethod.php:28
39	0.1819	1291728	Illuminate\Container\BoundMethod::addDependencyForCallParameter( )	.../BoundMethod.php:115
40	0.1829	1292048	Laravel\Lumen\Application->make( )	.../BoundMethod.php:155
41	0.1829	1292744	Illuminate\Container\Container->make( )	.../Application.php:208
42	0.1829	1292744	Illuminate\Container\Container->build( )	.../Container.php:565
43	0.1829	1292744	Laravel\Lumen\Application->Laravel\Lumen\{closure}( )	.../Container.php:678
44	0.1829	1292744	Laravel\Lumen\Application->loadComponent( )	.../Application.php:243
45	0.1834	1294248	Laravel\Lumen\Application->make( )	.../Application.php:555
46	0.1834	1294248	Illuminate\Container\Container->make( )	.../Application.php:208
47	0.1834	1294248	Illuminate\Container\Container->build( )	.../Container.php:565
48	0.1834	1294248	Laravel\Lumen\Application->Laravel\Lumen\{closure}( )	.../Container.php:678
49	0.1834	1294248	Laravel\Lumen\Application->loadComponent( )	.../Application.php:243
50	0.1834	1294248	Laravel\Lumen\Application->make( )	.../Application.php:555
51	0.1834	1294248	Illuminate\Container\Container->make( )	.../Application.php:208
52	0.1834	1294248	Illuminate\Container\Container->build( )	.../Container.php:565
53	0.1834	1294248	Laravel\Lumen\Application->Laravel\Lumen\{closure}( )	.../Container.php:678
54	0.1834	1294248	Laravel\Lumen\Application->loadComponent( )	.../Application.php:243

etc...

As you can see, 23 to 39 methods calls are making an infinite loop of this:

40	0.1829	1292048	Laravel\Lumen\Application->make( )	.../BoundMethod.php:155
41	0.1829	1292744	Illuminate\Container\Container->make( )	.../Application.php:208
42	0.1829	1292744	Illuminate\Container\Container->build( )	.../Container.php:565
43	0.1829	1292744	Laravel\Lumen\Application->Laravel\Lumen\{closure}( )	.../Container.php:678
44	0.1829	1292744	Laravel\Lumen\Application->loadComponent( )	.../Application.php:243

AWS result

Just an empty response with HTTP 500 Status code (with an execution time of 1700ms probably because of the following logs).

var/log/httpd/error_log file:

[Tue Mar 28 12:52:49.151452 2017] [:error] [pid 28426] [client 127.0.0.1:32934] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/app/current/vendor/illuminate/container/Container.php on line 549
[Tue Mar 28 12:52:49.595791 2017] [:error] [pid 28426] [client 127.0.0.1:32934] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php on line 54
[Tue Mar 28 12:53:02.218553 2017] [:error] [pid 28529] [client 127.0.0.1:36204] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /var/app/current/vendor/laravel/lumen-framework/src/Application.php on line 162
[Tue Mar 28 12:53:02.219761 2017] [:error] [pid 28529] [client 127.0.0.1:36204] PHP Fatal error:  Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0

Since I don't know where the issue is coming from, I can't fix it nor making a pull request.
The issue can also come from my side but it seems that the whole error comes from the core of Lumen and this dependency.

This may be the same issue as #13 except that, in my case, the body is properly filled:

{
  "displayName": "App\\Events\\MyEvent",
  "job": "Illuminate\\Queue\\CallQueuedHandler@call",
  "maxTries": null,
  "timeout": null,
  "data": {
    "commandName": "App\\Events\\MyEvent",
    "command": "O:15:\"App\\Events\\MyEvent\":6:{s:21:\"\u0000App\\Events\\MyEvent\u0000user\";O:45:\"Illuminate\\Contracts\\Database\\ModelIdentifier\":2:{s:5:\"class\";s:8:\"App\\User\";s:2:\"id\";i:2;}s:21:\"\u0000App\\Events\\MyEvent\u0000myModel\";O:45:\"Illuminate\\Contracts\\Database\\ModelIdentifier\":2:{s:5:\"class\";s:8:\"App\\MyModel\";s:2:\"id\";i:321;}s:6:\"\u0000*\u0000job\";N;s:10:\"connection\";s:8:\"sqs\";s:5:\"queue\";N;s:5:\"delay\";N;}"
  }
}

Thank you in advance for your help !

lock/mutex is never cleaned up when running a command with runInBackground()

<?php
$schedule
   ->command('some-command')
   ->runInBackground()
   ->withoutOverlapping()
   ->everyMinute();

running this with the console command php artisan schedule:run works perfectly and cleans up the lock file as expected.

if i remove "runInBackground" everything works as expected.
with runInBackground it seems to run the code but never cleans up
which causes future events to not be run

this actually stopped working after i upgraded from laravel 5.3 to 5.5.

no exceptions or other warnings are thrown

image

Too many requests

I think I'm misunderstanding something, but it looks like my Queue is receiving a message every minute even if its empty. Looking at the CRON schedule, I guess that's expected. But this is eating up my free tier for SQS with over 867k requests in two weeks. How do I lower the amount of messages sent to SQS, or stop a message being sent if its empty?

Error token mismatch

Not sure exactly what I am doing wrong but seems I am getting this on the worker schedule on AWS EB worker instance:

worker.ERROR: Illuminate\Session\TokenMismatchException in /var/app/current/bootstrap/cache/compiled.php:3227

So seems like the route is looking for Csrf token.

Do I simply need to exlude the route from the token verification?

Messages always in Flight

Hi, I'm using laravel 5.4 and after applying this package to my project worker, messages in my sqs stay always in flight. I've done everything that the readme file says...

127.0.0.1 (-) - - [21/Jun/2017:01:36:59 +0000] "POST /worker/schedule HTTP/1.1" 200 92 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:37:59 +0000] "POST /worker/schedule HTTP/1.1" 200 92 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:38:59 +0000] "POST /worker/schedule HTTP/1.1" 200 92 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:39:59 +0000] "POST /worker/schedule HTTP/1.1" 200 92 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:39:54 +0000] "POST /worker/queue HTTP/1.1" 500 84128 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:40:59 +0000] "POST /worker/schedule HTTP/1.1" 200 92 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:41:13 +0000] "POST /worker/queue HTTP/1.1" 500 84128 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:41:13 +0000] "POST /worker/queue HTTP/1.1" 500 84128 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:41:13 +0000] "POST /worker/queue HTTP/1.1" 500 84128 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:41:13 +0000] "POST /worker/queue HTTP/1.1" 500 84128 "-" "aws-sqsd/2.3"
127.0.0.1 (-) - - [21/Jun/2017:01:41:13 +0000] "POST /worker/queue HTTP/1.1" 500 84128 "-" "aws-sqsd/2.3"

Schedule request returns 302

I've installed the package in my project, but it looks like all the requests of '/worker/schedule' returns 302 status code on EB servers.
The package works perfectly on my local machine, and I made sure that the 'REGISTER_WORKER_ROUTES' env variable is turned on.

The logs:
/var/log/httpd/access_log:
127.0.0.1 (-) - - [16/Jul/2017:19:09:00 +0000] "POST /worker/schedule HTTP/1.1" 302 376 "-" "aws-sqsd/2.3"

/var/log/aws-sqsd/default.log:
2017-07-16T19:14:00Z message: sent to http://localhost:80/worker/schedule
2017-07-16T19:14:00Z http-err: b910dcd1-7713-429c-bfe3-2d5990e0f2fc (2) 302 - 0.037

Memory Issue?

Hey All, When I install this plugin on my Laravel 5.5 AWS Elastic Beanstalk worker I see that even for the simplest job hitting the queue it is maxing out 100% of the memory on my worker environment. Does anyone know why that would happen?

When I say the simplest job, I mean a job that get dispatched through SQS and uses the worker to log int he DB that it was touched.

Thanks!

Drop use of env function to support cached environments

env() function returns null when the configuration is cached and the "REGISTER_WORKER_ROUTES" environment variable is ignored.

I think it will be a good point to publish a configuration file and read the value from this file.

I think my worker app is working fine but my main app is not creating jobs.

127.0.0.1 (-) - - [16/Mar/2018:14:19:59 +0000] "POST /worker/schedule HTTP/1.1" 200 100 "-" "aws-sqsd/2.3"

My worker post on /worker/schedule.
But my main app is not responding at all. I have set the queue driver to sqs and set the credentials. Is there anything else I have to do in the main app to create the jobs?

Routes not registered

I am getting weird issue.

Having APP_ENV=production routes are not registered.
Setting APP_ENV to anything else fixes this - routes are registered as you would expect.

I see, this is expected behaviour, according to source code.
Is it possible to explain reasoning?

The command "schedule" does not exist. v0.1.21

We just updated to the new version and we receive the following error
The command "schedule" does not exist. {"exception":"[object] (Symfony\\Component\\Console\\Exception\\CommandNotFoundException(code: 0): The command \"schedule\" does not exist. at /var/app/current/vendor/laravel/framework/src/Illuminate/Console/Application.php:178)

Can it be related with the new cron option functionality? We are not using such functionality we are sticking with the classic schedule.

Messages Remain In Flight

I have set up both my Web Tier as well as my Worker Tier with the same App. The web tier has
REGISTER_WORKER_ROUTES=false whereas the worker tier has REGISTER_WORKER_ROUTES=true.

I am pushing a job to SQS which simply edits an attribute in the database. But every time I push a new job it increments the counter Messages In Flight and nothing else happens.

Support for Lumen 5.3?

Hey, it's me again, sorry to bug you again but I seem to have trouble with getting the worker work with Lumen 5.3.

This is the error I'm seeing

[2016-09-12 22:51:18] lumen.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Type error: Argument 3 passed to Illuminate\Queue\Worker::process() must be an instance of Illuminate\Queue\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php on line 81 in /var/app/current/vendor/illuminate/queue/Worker.php:199
Stack trace:
#0 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php(81): Illuminate\Queue\Worker->process('awseb-e-ptip9yx...', Object(Dusterio\AwsWorker\Jobs\AwsJob), 0, 0)
#1 [internal function]: Dusterio\AwsWorker\Controllers\WorkerController->queue(Object(Illuminate\Http\Request), Object(Illuminate\Queue\Worker), Object(Laravel\Lumen\Application))
#2 /var/app/current/vendor/illuminate/container/Container.php(507): call_user_func_array(Array, Array)
#3 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(610): Illuminate\Container\Container->call(Array, Array)
#4 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(553): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#5 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(512): Laravel\Lumen\Application->callControllerAction(Array)
#6 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(497): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#7 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(394): Laravel\Lumen\Application->handleFoundRoute(Array)
#8 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(650): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
#9 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(400): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#10 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(341): Laravel\Lumen\Application->dispatch(NULL)
#11 /var/app/current/public/index.php(28): Laravel\Lumen\Application->run()
#12 {main}  

I've downgraded to Lumen 5.2 for now.
Thanks.

eb deploy

Not a package issue, but just wondering how you do deployments, or if you have any tips for deployment?

Usually if you're using EB CLI, you have branch defaults in config, so doing eb deploy - deploys proper branch to a proper environment. Is there any way to group the environments (web + worker), so if you deploy to one - it would auto-deploy the same version to the other environment?

Delayed Dispatching Issue with Auto-Scale or Server Failure

I noticed that the delayed job dispatch will hold the job on the server until the delay time is met, and then send it to SQS. This means that if a server goes down before the job is triggered and sent to SQS, it will not be sent at all and thus never run. Is there a way to circumvent this or incorporate better support for laravel job dispatching delays?

Kind of confused between what should be on the app, and what should be on the worker

Hi,

I have to tell it is the first time I use a Worker in Elastic Beanstalk.

I'm a bit confused, because I followed all documentation, and nothing happens :( My worker should send me an email every minutes.

In the Worker logs, I just have:

-------------------------------------
/tmp/sample-app.log
-------------------------------------
2017-03-07 22:09:59 Received task task1 scheduled at 2017-03-07T22:10:00Z.
2017-03-07 22:10:59 Received task task1 scheduled at 2017-03-07T22:11:00Z.
2017-03-07 22:11:59 Received task task1 scheduled at 2017-03-07T22:12:00Z.
2017-03-07 22:12:59 Received task task1 scheduled at 2017-03-07T22:13:00Z.
2017-03-07 22:13:59 Received task task1 scheduled at 2017-03-07T22:14:00Z.
2017-03-07 22:14:59 Received task task1 scheduled at 2017-03-07T22:15:00Z.
2017-03-07 22:15:59 Received task task1 scheduled at 2017-03-07T22:16:00Z.
2017-03-07 22:16:59 Received task task1 scheduled at 2017-03-07T22:17:00Z.
2017-03-07 22:17:59 Received task task1 scheduled at 2017-03-07T22:18:00Z.
2017-03-07 22:18:59 Received task task1 scheduled at 2017-03-07T22:19:00Z.
2017-03-07 22:19:59 Received task task1 scheduled at 2017-03-07T22:20:00Z.
2017-03-07 22:20:59 Received task task1 scheduled at 2017-03-07T22:21:00Z.
2017-03-07 22:21:59 Received task task1 scheduled at 2017-03-07T22:22:00Z.
2017-03-07 22:22:59 Received task task1 scheduled at 2017-03-07T22:23:00Z.
2017-03-07 22:23:59 Received task task1 scheduled at 2017-03-07T22:24:00Z.

So, I don't really know if your plugin should be installed in the Main App, or in the worker
The same with cron.yaml, should I install it on the worker???

All I have done is on the main app, I think it is the right way to do this, but I don't really know what task1 is, and no mail is being sent, that's why I think I have missed something...

In my SQS Queue, I can also see no queued job, so, definitively something is not working as it should... Any idea how should I debug it?

Laravel 5.6 issue

After updating to Laravel 5.6, the server responds with error 500 when a message arrive in the worker.

Anyone having this issue?

Multiple Worker Server Environment

Hi,
Thanks for this awesome package. Can you tell me how this handle scheduler command when there are multiple web server are running. Is it only run on one worker server Or the the scheduler will run on every worker server and this will cause duplicate message in the queue ?

thanks!

Followed the installation but EB worker is reporting 404 on /worker/schedule

I have the cron setup to point to /worker/schedule but when deploying to EB it goes between ok and severe, the logs are saying the endpoint is returning a 404,

I have the queue setup and have the correct details in the application as well.

Do you have any ideas of what im missing?

Laravel version 5.4

Please allow Laravel v6 in your composer file.

Laravel 6 was officially released today. They are simply moving to SemVer and should not be considered a major breaking change update. Please allow your package to include illuminate/support ^6.0

Does not work with Lumen 5.6

Due to how the serviceprovide has a preg match it is not passing in the correct parameter to add routes. It should be more flexible to cater for future versions of lumen.

It should pass in app->router but is instead passing ->app only

SQS messages (scheduler and queued jobs) stuck in flight then moved to dead queue

I'm trying to implement this package for my application's scheduling and queues.

The scheduling is working great except that the messages look like they're stuck In Flight and don't get deleted properly.

I think I have mostly everything set up correctly. SQS is receiving the messages on the queue and the messages are immediately put into "In flight" and stay there until what I think is the visibility timeout occurs, and then it gets put onto the dead queue.

When I look at the dead queue I can see that the scheduler is being called once per minute with the following data:
Message body:

elasticbeanstalk scheduled job

Message Attributes:

Name Type Value
beanstalk.sqsd.path String /worker/schedule
beanstalk.sqsd.scheduled_time String 2017-03-22 23:10:00 UTC
beanstalk.sqsd.task_name String schedule

When I queue a command, the message body has the correct JSON data format since I'm just calling it from Laravel's default queueing (I had database driver before this and it worked fine, and the payload looks identical to what the message body is here). But the message attributes is empty.

So I'm not really sure what I have set up incorrectly. The scheduler is running and it's calling the scheduler methods, but the messages are staying In Flight and eventually being put onto the dead queue. And the queued jobs aren't being run at all and have the same behaviour as the scheduler messages (stuck In Flight and then moved to dead queue).

Please support minor versions of Laravel 6.x

Running Laravel 6.2, receiving this error:

ERROR: Argument 3 passed to Illuminate\Queue\Worker::process() must be an instance of Illuminate\Queue\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31

I can see the error is in \Integrations\BindsWorker. All supported minor versions are hardcoded here:

   /**
     * @var array
     */
    protected $workerImplementations = [
        '5\.[345678]\.\d+' => Laravel53Worker::class,
        '6\.[01]\.\d+' => Laravel6Worker::class
    ];

Minor versions are going to be coming faster than before, so I suspect this approach is not sustainable.

develop.ERROR: Argument 3 passed to Illuminate\Queue\Worker::process() must be an instance of Illuminate\Queue\WorkerOptions

Whenever I add the job to the queue it is being added however on my worker I get this error problem

[2018-09-18 09:48:29] develop.ERROR: Argument 3 passed to Illuminate\Queue\Worker::process() must be an instance of Illuminate\Queue\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 3 passed to Illuminate\\Queue\\Worker::process() must be an instance of Illuminate\\Queue\\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 at /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:312)
[stacktrace]
#0 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php(31): Illuminate\\Queue\\Worker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), 0, 0)
#1 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php(82): Dusterio\\AwsWorker\\Wrappers\\DefaultWorker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), Array)
#2 [internal function]: Dusterio\\AwsWorker\\Controllers\\WorkerController->queue(Object(Illuminate\\Http\\Request), Object(Dusterio\\AwsWorker\\Wrappers\\DefaultWorker), Object(Illuminate\\Foundation\\Application), Object(Incase\\Exceptions\\Handler))
#3 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/LaravelController.php(45): call_user_func_array(Array, Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Dusterio\\AwsWorker\\Controllers\\LaravelController->callAction('queue', Array)
#5 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Dusterio\\AwsWorker\\Controllers\\WorkerController), 'queue')
#6 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#7 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(679): Illuminate\\Routing\\Route->run()
#8 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#9 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#11 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#12 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(622): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#13 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(611): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#14 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#15 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/app/current/vendor/barryvdh/laravel-cors/src/HandleCors.php(36): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Barryvdh\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/app/current/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#32 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#36 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#37 /var/app/current/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#38 {main}
"}
[2018-09-18 09:48:39] develop.ERROR: Argument 3 passed to Illuminate\Queue\Worker::process() must be an instance of Illuminate\Queue\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 3 passed to Illuminate\\Queue\\Worker::process() must be an instance of Illuminate\\Queue\\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 at /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:312)
[stacktrace]
#0 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php(31): Illuminate\\Queue\\Worker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), 0, 0)
#1 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php(82): Dusterio\\AwsWorker\\Wrappers\\DefaultWorker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), Array)
#2 [internal function]: Dusterio\\AwsWorker\\Controllers\\WorkerController->queue(Object(Illuminate\\Http\\Request), Object(Dusterio\\AwsWorker\\Wrappers\\DefaultWorker), Object(Illuminate\\Foundation\\Application), Object(Incase\\Exceptions\\Handler))
#3 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/LaravelController.php(45): call_user_func_array(Array, Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Dusterio\\AwsWorker\\Controllers\\LaravelController->callAction('queue', Array)
#5 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Dusterio\\AwsWorker\\Controllers\\WorkerController), 'queue')
#6 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#7 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(679): Illuminate\\Routing\\Route->run()
#8 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#9 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#11 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#12 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(622): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#13 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(611): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#14 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#15 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/app/current/vendor/barryvdh/laravel-cors/src/HandleCors.php(36): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Barryvdh\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/app/current/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#32 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#36 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#37 /var/app/current/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#38 {main}
"}
[2018-09-18 09:50:12] develop.ERROR: Argument 3 passed to Illuminate\Queue\Worker::process() must be an instance of Illuminate\Queue\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 3 passed to Illuminate\\Queue\\Worker::process() must be an instance of Illuminate\\Queue\\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 at /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:312)
[stacktrace]
#0 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php(31): Illuminate\\Queue\\Worker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), 0, 0)
#1 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php(82): Dusterio\\AwsWorker\\Wrappers\\DefaultWorker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), Array)
#2 [internal function]: Dusterio\\AwsWorker\\Controllers\\WorkerController->queue(Object(Illuminate\\Http\\Request), Object(Dusterio\\AwsWorker\\Wrappers\\DefaultWorker), Object(Illuminate\\Foundation\\Application), Object(Incase\\Exceptions\\Handler))
#3 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/LaravelController.php(45): call_user_func_array(Array, Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Dusterio\\AwsWorker\\Controllers\\LaravelController->callAction('queue', Array)
#5 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Dusterio\\AwsWorker\\Controllers\\WorkerController), 'queue')
#6 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#7 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(679): Illuminate\\Routing\\Route->run()
#8 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#9 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#11 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#12 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(622): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#13 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(611): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#14 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#15 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/app/current/vendor/barryvdh/laravel-cors/src/HandleCors.php(36): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Barryvdh\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/app/current/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#32 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#36 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#37 /var/app/current/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#38 {main}
"}
[2018-09-18 09:50:29] develop.ERROR: Argument 3 passed to Illuminate\Queue\Worker::process() must be an instance of Illuminate\Queue\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Argument 3 passed to Illuminate\\Queue\\Worker::process() must be an instance of Illuminate\\Queue\\WorkerOptions, integer given, called in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php on line 31 at /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:312)
[stacktrace]
#0 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/DefaultWorker.php(31): Illuminate\\Queue\\Worker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), 0, 0)
#1 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php(82): Dusterio\\AwsWorker\\Wrappers\\DefaultWorker->process('awseb-e-vzbjbgk...', Object(Dusterio\\AwsWorker\\Jobs\\AwsJob), Array)
#2 [internal function]: Dusterio\\AwsWorker\\Controllers\\WorkerController->queue(Object(Illuminate\\Http\\Request), Object(Dusterio\\AwsWorker\\Wrappers\\DefaultWorker), Object(Illuminate\\Foundation\\Application), Object(Incase\\Exceptions\\Handler))
#3 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/LaravelController.php(45): call_user_func_array(Array, Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Dusterio\\AwsWorker\\Controllers\\LaravelController->callAction('queue', Array)
#5 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Dusterio\\AwsWorker\\Controllers\\WorkerController), 'queue')
#6 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#7 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(679): Illuminate\\Routing\\Route->run()
#8 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#9 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#10 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(681): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#11 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#12 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(622): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#13 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Router.php(611): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#14 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#15 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#16 /var/app/current/vendor/barryvdh/laravel-cors/src/HandleCors.php(36): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Barryvdh\\Cors\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 /var/app/current/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#23 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#26 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#30 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#31 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#32 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 /var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#35 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#36 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#37 /var/app/current/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#38 {main}
"}

What can I do to fix it?

A job may execute twice when it takes a long time to run

Hi! From what I understand, when you have a multiple worker server environment there should be no jobs executed twice thanks to the fact that AWS automatically deletes successfully executed jobs from the queue.

What concerns me, though, is that the way AWS achieves this is by setting a visibility timeout period (https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html) for the delivered queue messages of 30 secs. If your worker doesn't respond within 30 seconds that timeout is over and other workers may receive that same job, running it again.
The reason why I'm raising this is that I've got some jobs that run for longer than 30 seconds and I need them to execute only once (the order doesn't matter).

Am I missing something? Can you think of any solution?

Tasks executing twice

The Schedule function in App\Console\Kernel is being called twice every minute (1-3 seconds apart).
I have a call in the Schedule function as follows:

$schedule->call(function() {
    // Create record in database
})->everyMinute();

Every minute I see two of these records created seconds apart. For additional testing I moved the record creation outside of the ->call() and directly into the Schedule function and that is also appearing twice in the database, which means the Schedule function is being called twice per minute.

I'm not sure how to fix this. I followed the guide word by word and installed the library on my AWS worker environment only. Online solutions suggest returning a 200 response but I have no idea where I would do that.

Has anyone else encountered this problem or know what I could do to fix it?

BindingResolutionException occurred in queue method call

I've upgraded Laravel from 5.3 to 5.4. I've encountered this errors a lot in production environment:

Illuminate\Contracts\Container\BindingResolutionException

This exception is thrown in /Dusterio\AwsWorker\Controllers\WorkerController@queue

The error message detail is as follows:
Error message Illuminate\Contracts\Container\BindingResolutionException: Exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Unresolvable dependency resolving [Parameter #0 [ <required> $event ]] in class Illuminate\Broadcasting\BroadcastEvent' in /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php:910

…ar/app/current/vendor/laravel/framework/src/Illuminate/Container/ Container.php (848) …ar/app/current/vendor/laravel/framework/src/Illuminate/Container/ Container.php (789) …ar/app/current/vendor/laravel/framework/src/Illuminate/Container/ Container.php (757) …ar/app/current/vendor/laravel/framework/src/Illuminate/Container/ Container.php (608) …ar/app/current/vendor/laravel/framework/src/Illuminate/Container/ Container.php (575) …app/current/vendor/laravel/framework/src/Illuminate/Foundation/ Application.php (728) …at /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/Jobs/ Job.php (170) …at /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/Jobs/ Job.php (69) …led at /var/app/current/vendor/dusterio/laravel-aws-worker/src/Jobs/ AwsJob.php (46) …d at /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/ Worker.php (317) …pp/current/vendor/dusterio/laravel-aws-worker/src/Wrappers/ Laravel53Worker.php (34) …urrent/vendor/dusterio/laravel-aws-worker/src/Controllers/ WorkerController.php (82) in Dusterio\AwsWorker\Controllers\WorkerController::queue called at ? (?) …rrent/vendor/dusterio/laravel-aws-worker/src/Controllers/ LaravelController.php (45) …rrent/vendor/laravel/framework/src/Illuminate/Routing/ ControllerDispatcher.php (44) … at /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Route.php (203) … at /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Route.php (160) …at /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Router.php (572) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (30) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (102) …at /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Router.php (574) …at /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Router.php (533) …at /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Router.php (511) …app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/ Kernel.php (176) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (30) …losure} called at /var/app/current/vendor/fideloper/proxy/src/ TrustProxies.php (56) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …t/vendor/itsgoingd/clockwork/Clockwork/Support/Laravel/ ClockworkMiddleware.php (41) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …nate\Routing\{closure} called at /var/app/current/app/Http/Middleware/ Cors.php (23) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …avel/framework/src/Illuminate/Cookie/Middleware/ AddQueuedCookiesToResponse.php (37) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …t/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/ EncryptCookies.php (59) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …avel/framework/src/Illuminate/Foundation/Http/Middleware/ TransformsRequest.php (30) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …avel/framework/src/Illuminate/Foundation/Http/Middleware/ TransformsRequest.php (30) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …ravel/framework/src/Illuminate/Foundation/Http/Middleware/ ValidatePostSize.php (27) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …ramework/src/Illuminate/Foundation/Http/Middleware/ CheckForMaintenanceMode.php (46) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (148) … /var/app/current/vendor/laravel/framework/src/Illuminate/Routing/ Pipeline.php (53) …/var/app/current/vendor/laravel/framework/src/Illuminate/Pipeline/ Pipeline.php (102) …app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/ Kernel.php (151) …app/current/vendor/laravel/framework/src/Illuminate/Foundation/Http/ Kernel.php (116) …ate\Foundation\Http\Kernel::handle called at /var/app/current/public/ index.php (52)

Schedule not working - HTTP 301

I've installed the package and set up a worker environment with the cron.yaml file, however it doesn't seem like the schedule method is being run.

From the worker's access log:

127.0.0.1 (-) - - [26/Oct/2016:21:16:59 +0000] "POST /worker/schedule HTTP/1.1" 301 225 "-" "aws-sqsd/2.3"

Do you have any idea what could be the issue here?

413 Entity too large?

I am having trouble understanding how the way this package works, I send an email with a few attachments, so it does get send to sqs, however when it's being processed by the worker I am getting this issue:

[2019-10-24 10:06:36] production.ERROR: Error executing "SendMessage" on "https://sqs.eu-west-2.amazonaws.com/952502652332/awseb-e-2epdmi3t3g-stack-AWSEBWorkerQueue-15LRTRCTWTMEW"; AWS HTTP error: Client error: `POST https://sqs.eu-west-2.amazonaws.com/952502652332/awseb-e-2epdmi3t3g-stack-AWSEBWorkerQueue-15LRTRCTWTMEW` resulted in a `413 Request Entity Too Large` response:
HTTP content length exceeded 1662976 bytes.
 Unable to parse error information from response - Error parsing XML: String could not be parsed as XML {"exception":"[object] (Aws\\Sqs\\Exception\\SqsException(code: 0): Error executing \"SendMessage\" on \"https://sqs.eu-west-2.amazonaws.com/952502652332/awseb-e-2epdmi3t3g-stack-AWSEBWorkerQueue-15LRTRCTWTMEW\"; AWS HTTP error: Client error: `POST https://sqs.eu-west-2.amazonaws.com/952502652332/awseb-e-2epdmi3t3g-stack-AWSEBWorkerQueue-15LRTRCTWTMEW` resulted in a `413 Request Entity Too Large` response:
HTTP content length exceeded 1662976 bytes.
 Unable to parse error information from response - Error parsing XML: String could not be parsed as XML at /var/app/current/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:195, GuzzleHttp\\Exception\\ClientException(code: 413): Client error: `POST https://sqs.eu-west-2.amazonaws.com/952502652332/awseb-e-2epdmi3t3g-stack-AWSEBWorkerQueue-15LRTRCTWTMEW` resulted in a `413 Request Entity Too Large` response:
HTTP content length exceeded 1662976 bytes.
 at /var/app/current/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113)
[stacktrace]
#0 /var/app/current/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php(100): Aws\\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\\Psr7\\Request), Object(Aws\\Command), Array)
#1 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(203): Aws\\WrappedHttpHandler->Aws\\{closure}(Array)
#2 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(174): GuzzleHttp\\Promise\\Promise::callHandler(2, Array, Array)
#3 /var/app/current/vendor/guzzlehttp/promises/src/RejectedPromise.php(40): GuzzleHttp\\Promise\\Promise::GuzzleHttp\\Promise\\{closure}(Array)
#4 /var/app/current/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\\Promise\\RejectedPromise::GuzzleHttp\\Promise\\{closure}()
#5 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(98): GuzzleHttp\\Promise\\TaskQueue->run()
#6 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(125): GuzzleHttp\\Handler\\CurlMultiHandler->tick()
#7 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\\Handler\\CurlMultiHandler->execute(true)
#8 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(223): GuzzleHttp\\Promise\\Promise->invokeWaitFn()
#9 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\\Promise\\Promise->waitIfPending()
#10 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\\Promise\\Promise->invokeWaitList()
#11 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\\Promise\\Promise->waitIfPending()
#12 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\\Promise\\Promise->invokeWaitList()
#13 /var/app/current/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\\Promise\\Promise->waitIfPending()
#14 /var/app/current/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): GuzzleHttp\\Promise\\Promise->wait()
#15 /var/app/current/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(86): Aws\\AwsClient->execute(Object(Aws\\Command))
#16 /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php(89): Aws\\AwsClient->__call('sendMessage', Array)
#17 /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/SqsQueue.php(75): Illuminate\\Queue\\SqsQueue->pushRaw('{\"displayName\":...', NULL)
#18 /var/app/current/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(44): Illuminate\\Queue\\SqsQueue->push(Object(Illuminate\\Events\\CallQueuedListener), '', NULL)
#19 /var/app/current/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(472): Illuminate\\Queue\\Queue->pushOn(NULL, Object(Illuminate\\Events\\CallQueuedListener))
#20 /var/app/current/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(431): Illuminate\\Events\\Dispatcher->queueHandler('Incase\\\\Listener...', 'handle', Array)
#21 [internal function]: Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}(Object(Illuminate\\Mail\\Events\\MessageSent))
#22 /var/app/current/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(366): call_user_func_array(Object(Closure), Array)
#23 /var/app/current/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(196): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}('Illuminate\\\\Mail...', Array)

However the actual email is send, but the item is put back in the queue and same errors appear, so it resends the email several times. What could have happened here? Why does it put to the queue but when retrieved from the queue it complain about it being too big?

Suddenly /worker/queue 404 error

Hi, I've been using this in my project. Everything was working fine and then suddenly I get a 404 error. http://prntscr.com/km7t9q

This has happened to me before, re-creating the worker worked but I did that twice already and same problem happens again. I do not want to re-create the server again.

Please help me ASAP.

QueueManager Singleton

What is the technical reason for this package binding the QueueManager to a singleton?

This is causing issues with our queue configuration.

Throwing Exception

Error : exception 'Dusterio\AwsWorker\Exceptions\MalformedRequestException' with message 'Unable to decode request JSON'

Random curl errors

I've been running into this error from time to time. Error seems to be an error related to ssl certs but unclear how to handle it.

Maybe there should be an option to switch off ssl validation? Just FYI.

[2016-08-26 20:01:30] lumen.ERROR: GuzzleHttp\Exception\RequestException: cURL error 77:  (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:187
Stack trace:
#0 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 newrelic/Guzzle6(1): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#6 /var/app/current/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(72): newrelic\Guzzle6\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#7 /var/app/current/vendor/guzzlehttp/guzzle/src/Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#8 /var/app/current/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(68): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#9 /var/app/current/vendor/guzzlehttp/guzzle/src/Middleware.php(59): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#10 /var/app/current/vendor/guzzlehttp/guzzle/src/HandlerStack.php(67): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#11 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(275): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#12 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(123): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#13 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(129): GuzzleHttp\Client->requestAsync('post', Object(GuzzleHttp\Psr7\Uri), Array)
#14 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(87): GuzzleHttp\Client->request('post', 'https://mandril...', Array)
#15 /var/app/current/vendor/illuminate/mail/Transport/MandrillTransport.php(57): GuzzleHttp\Client->__call('post', Array)
#16 /var/app/current/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(85): Illuminate\Mail\Transport\MandrillTransport->send(Object(Swift_Message), Array)
#17 /var/app/current/vendor/illuminate/mail/Mailer.php(385): Swift_Mailer->send(Object(Swift_Message), Array)
#18 /var/app/current/vendor/illuminate/mail/Mailer.php(171): Illuminate\Mail\Mailer->sendSwiftMessage(Object(Swift_Message))
#19 /var/app/current/vendor/illuminate/mail/Mailer.php(276): Illuminate\Mail\Mailer->send('emails.retarget...', Array, Object(Closure))
#20 /var/app/current/vendor/illuminate/queue/Jobs/Job.php(130): Illuminate\Mail\Mailer->handleQueuedMessage(Object(Dusterio\AwsWorker\Jobs\AwsJob), Array)
#21 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Jobs/AwsJob.php(41): Illuminate\Queue\Jobs\Job->resolveAndFire(Array)
#22 /var/app/current/vendor/illuminate/queue/Worker.php(213): Dusterio\AwsWorker\Jobs\AwsJob->fire()
#23 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php(81): Illuminate\Queue\Worker->process('awseb-e-6ux2r39...', Object(Dusterio\AwsWorker\Jobs\AwsJob), 0, 0)
#24 [internal function]: Dusterio\AwsWorker\Controllers\WorkerController->queue(Object(Illuminate\Http\Request), Object(Illuminate\Queue\Worker), Object(Laravel\Lumen\Application))
#25 /var/app/current/vendor/illuminate/container/Container.php(507): call_user_func_array(Array, Array)
#26 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(593): Illuminate\Container\Container->call(Array, Array)
#27 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(536): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#28 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(501): Laravel\Lumen\Application->callControllerAction(Array)
#29 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(486): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#30 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(383): Laravel\Lumen\Application->handleFoundRoute(Array)
#31 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(636): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
#32 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(389): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#33 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(334): Laravel\Lumen\Application->dispatch(NULL)
#34 /var/app/current/public/index.php(28): Laravel\Lumen\Application->run()
#35 {main}

Next Dusterio\AwsWorker\Exceptions\FailedJobException: Worker failed executing the job in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php:84
Stack trace:
#0 [internal function]: Dusterio\AwsWorker\Controllers\WorkerController->queue(Object(Illuminate\Http\Request), Object(Illuminate\Queue\Worker), Object(Laravel\Lumen\Application))
#1 /var/app/current/vendor/illuminate/container/Container.php(507): call_user_func_array(Array, Array)
#2 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(593): Illuminate\Container\Container->call(Array, Array)
#3 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(536): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#4 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(501): Laravel\Lumen\Application->callControllerAction(Array)
#5 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(486): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#6 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(383): Laravel\Lumen\Application->handleFoundRoute(Array)
#7 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(636): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
#8 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(389): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#9 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(334): Laravel\Lumen\Application->dispatch(NULL)
#10 /var/app/current/public/index.php(28): Laravel\Lumen\Application->run()
#11 {main}  
[2016-08-26 20:01:30] lumen.ERROR: GuzzleHttp\Exception\RequestException: cURL error 77:  (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:187
Stack trace:
#0 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(150): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#3 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#4 /var/app/current/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 newrelic/Guzzle6(1): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#6 /var/app/current/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(72): newrelic\Guzzle6\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#7 /var/app/current/vendor/guzzlehttp/guzzle/src/Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#8 /var/app/current/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(68): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#9 /var/app/current/vendor/guzzlehttp/guzzle/src/Middleware.php(59): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#10 /var/app/current/vendor/guzzlehttp/guzzle/src/HandlerStack.php(67): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#11 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(275): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#12 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(123): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#13 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(129): GuzzleHttp\Client->requestAsync('post', Object(GuzzleHttp\Psr7\Uri), Array)
#14 /var/app/current/vendor/guzzlehttp/guzzle/src/Client.php(87): GuzzleHttp\Client->request('post', 'https://mandril...', Array)
#15 /var/app/current/vendor/illuminate/mail/Transport/MandrillTransport.php(57): GuzzleHttp\Client->__call('post', Array)
#16 /var/app/current/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(85): Illuminate\Mail\Transport\MandrillTransport->send(Object(Swift_Message), Array)
#17 /var/app/current/vendor/illuminate/mail/Mailer.php(385): Swift_Mailer->send(Object(Swift_Message), Array)
#18 /var/app/current/vendor/illuminate/mail/Mailer.php(171): Illuminate\Mail\Mailer->sendSwiftMessage(Object(Swift_Message))
#19 /var/app/current/vendor/illuminate/mail/Mailer.php(276): Illuminate\Mail\Mailer->send('emails.retarget...', Array, Object(Closure))
#20 /var/app/current/vendor/illuminate/queue/Jobs/Job.php(130): Illuminate\Mail\Mailer->handleQueuedMessage(Object(Dusterio\AwsWorker\Jobs\AwsJob), Array)
#21 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Jobs/AwsJob.php(41): Illuminate\Queue\Jobs\Job->resolveAndFire(Array)
#22 /var/app/current/vendor/illuminate/queue/Worker.php(213): Dusterio\AwsWorker\Jobs\AwsJob->fire()
#23 /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php(81): Illuminate\Queue\Worker->process('awseb-e-6ux2r39...', Object(Dusterio\AwsWorker\Jobs\AwsJob), 0, 0)
#24 [internal function]: Dusterio\AwsWorker\Controllers\WorkerController->queue(Object(Illuminate\Http\Request), Object(Illuminate\Queue\Worker), Object(Laravel\Lumen\Application))
#25 /var/app/current/vendor/illuminate/container/Container.php(507): call_user_func_array(Array, Array)
#26 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(593): Illuminate\Container\Container->call(Array, Array)
#27 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(536): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#28 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(501): Laravel\Lumen\Application->callControllerAction(Array)
#29 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(486): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#30 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(383): Laravel\Lumen\Application->handleFoundRoute(Array)
#31 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(636): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
#32 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(389): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#33 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(334): Laravel\Lumen\Application->dispatch(NULL)
#34 /var/app/current/public/index.php(28): Laravel\Lumen\Application->run()
#35 {main}

Next Dusterio\AwsWorker\Exceptions\FailedJobException: Worker failed executing the job in /var/app/current/vendor/dusterio/laravel-aws-worker/src/Controllers/WorkerController.php:84
Stack trace:
#0 [internal function]: Dusterio\AwsWorker\Controllers\WorkerController->queue(Object(Illuminate\Http\Request), Object(Illuminate\Queue\Worker), Object(Laravel\Lumen\Application))
#1 /var/app/current/vendor/illuminate/container/Container.php(507): call_user_func_array(Array, Array)
#2 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(593): Illuminate\Container\Container->call(Array, Array)
#3 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(536): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#4 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(501): Laravel\Lumen\Application->callControllerAction(Array)
#5 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(486): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#6 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(383): Laravel\Lumen\Application->handleFoundRoute(Array)
#7 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(636): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
#8 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(389): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#9 /var/app/current/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(334): Laravel\Lumen\Application->dispatch(NULL)
#10 /var/app/current/public/index.php(28): Laravel\Lumen\Application->run()
#11 {main}  

Error 500 in AWS SQS

Hey, I had my application and my worker set up in elasticbeanstalk. The jobs are being sent to the queue, however, in the log, I am getting 500 inside the eb of the SQS worker. It's been pointing to localhost or something all this while and receive 500. Does anyone have any idea?

2018-09-27T08:26:55Z message: sent to http://localhost:80/worker/queue
2018-09-27T08:26:55Z message: sent to http://localhost:80/worker/queue
2018-09-27T08:26:55Z message: sent to http://localhost:80/worker/queue
2018-09-27T08:26:55Z message: sent to http://localhost:80/worker/queue
2018-09-27T08:26:57Z http-err: ae772911-9a93-4d3f-9092-fc1970fe3807 (3) 500 - 1.466
2018-09-27T08:26:57Z http-err: 587a7bcb-8b59-48f3-837f-728b15eabf03 (3) 500 - 1.468
2018-09-27T08:26:57Z http-err: 9c455c9c-91a2-4046-8ebe-d933a927afc4 (3) 500 - 1.468
2018-09-27T08:26:57Z http-err: 3002f36b-b99c-4fb3-91b5-ebdc6db0bbe9 (3) 500 - 1.506

Advantages of processing using laravel jobs

Hi,

I'm a little bit confused.. The advantage of using this package is that we can schedule and retrieve the jobs in a "laravel standard" way?

Currently I've created some POST routes, available only in the worker environment and they process all the time consuming tasks directlly, returning 200 if all went fine.

Example:

if(isWebEnvironment){
$app->post('/email', function(){
....
$client->sendMessage(array(
'QueueUrl' => $queueUrl,
'MessageBody' => 'An awesome message!',
));
});
}
if(isWorkerEnvironment){
$app->post('/sqs', function(){
... "send email"..
});
}

So, the web environment push a message to the SQS and the SQS itself post that message to the worker environment.. Using this package will lead to a better performance ? Or the goal is just to use the standard laravel queue pushing-pulling.. ?

Thanks in advance !

When queued mail includes routes(), It generate http://localhost

SQS daemon request to localhost in ElasticBeanstalk worker environment.
When the queued mail processed by worker and its mail include routes() laravel helper function, It doesn't work as I expected.

For example,

  • In the site of https://example.com, user requests and then the mail does not accumulate in queue is processed. route('dummy') generate https://example.com/dummy.
  • On the other hand, when the mail queued, the routes() helper function generate https://localhost/dummy

The reason is that routes()' depends on $request->root()`.

To Prevent this problem, there are some solutions.

OUT of this library, I set APP_ENV='https://example.com' and then the program register to AppServiceProvider.

if (env('REGISTER_WORKER_ROUTES', true)) {
    URL::forceRootUrl(config('app.url'));
}

If I fix IN this library, I may add program bellow and write note to readme.

    public function register()
    {
        if (function_exists('env') && ! env('REGISTER_WORKER_ROUTES', true)) return;
        
        URL::forceRootUrl(config('app.url'));
        ...
    }

I'd really appreciate it if you could give me your opinion.

Unclear documentation

Your documentation is unclear as to how a queue sent to SQS is processed in a Laravel/Lumen.

First off, your /worker/schedule endpoint seems to be successful in firing scheduled jobs within Console/Kernel.php but I don't see the purpose of your code as you could just set cron.yaml to run whatever endpoint you want (when you want). Not to mention that your sample code $schedule->command('inspire') just causes more confusion. (inspire?)

I've tried sending jobs to SQS but how exactly is your code supposed to handle the jobs? Calling /worker/schedule does nothing unless I implement $schedule->command('queue:work')->everyMinute(); and even if I do, I don't see what the difference is from just calling Artisan::call('queue:work'); from any end point and have cron.yaml call it every minute.

Wrong url on Worker machine email functionality

Hi mate, I've been strugglin with something for the past hours or so and maybe you can point me in the right direction here. I've been using your lib for some time now (congratulations, it's amazing!) and I'm having an error when I try to send an email asynchronously. The blade template for the email is this one, very simple:
Click here to reset your password: {{ url('/password/reset/' . $token) }}
But even though I have the right url set on my config/app.php file it keeps sending me the wrong link, like this:
Click here to reset your password: http://localhost/password/reset/f2bffeaac16ba3765aa4404c40f5b13675e5bb1cb2abbdbc7ba5f0af655e4969
If I change the queue driver to sync and execute the code manually inside the worker machine it works perfectly but as soon as I get back to using the sqs driver. Do you reckon this has something to do with the lib itself?
Thank you very much for the lib and the possible help =)
Cheers

Queue

Hello,

How do i set up the queue with this? I don't see any explanation on how the queue works. How does AWS know to push it to that specific route?

I'm a bit confused.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.