Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

simonl's avatar

Queue worker not working AWS Elastic Beanstalk

Hi guys,

Im having a bit of trouble with getting my queues to work on AWS Elastic beanstalk. I have configured supervisor with the following config:

[program:laravel-worker] process_name=%(program_name)s_%(process_num)02d command=php /var/www/html/artisan queue:work database --sleep=3 --tries=2 --daemon autostart=true autorestart=true numprocs=1 redirect_stderr=true stdout_logfile=/var/www/html/storage/logs/laravel.log stopwaitsecs=3600

This config isn't the problem as the daemon runs with no errors:

sudo supervisorctl status

laravel-worker:laravel-worker_00 RUNNING pid 8189, uptime 0:22:47

Im really not sure whats going on as if i SSH into the server and run: queue:work database --sleep=3 --tries=2 --daemon it listens but picks nothing up if i dispatch something to the queue.

This all works fine on my local.

Any help would be great!

0 likes
3 replies
alexandersix's avatar

Hi @simonl!

Without knowing more specifics or seeing any code, it’s a bit hard to come to a firm conclusion, but since you have something working locally that isn’t working the same on AWS, a few things come to mind:

  1. Have you checked to see if your .env file is correct on the Elastic Beanstalk instance? Maybe there are some bad values set there that would make your queue not work.

  2. Relating to #1, did you cache your config files and then proceed to make a change to an .env value that was referenced in those config files? If so, try re-caching your config files and see if that fixes something.

  3. Are you using the same queue driver on the Elastic Beanstalk instance as you are locally? And as a follow-up, are you using the drivers that you think you’re using on Elastic Beanstalk, according to your .env file?

  4. Have you checked your laravel logs to see if there are any system errors when trying to push a job onto your selected queue?

Just from reading your question, it really seems like there is some sort of interruption between your Laravel app and whatever is hosting your queue—almost like the app is pushing the job out, but somehow it’s not going to the right place. I’d start your sleuthing there, and if you want to come back with these answers and potentially some more insight into exactly what’s going on, I’d be happy to help debug further!

Best of luck!

simonl's avatar

Thanks for coming back to me. I have checked all the above. The funny thing is it works fine on my local server but when i push it to AWS ec2 the queue process runs without any errors php artisan queue:listen database but it just will not process the jobs when i dispatch them. I have checked the database and dispatch is adding a record to the jobs table.

alexandersix's avatar

Alright @simonl, let's look into a few other things.

First and foremost, what version of Laravel are you using? That might help us narrow down any potential issues!

Ok, so the fact that your app is storing jobs in the jobs table makes me think that your configuration variables are correct (which is good!), but brings up a few other potential issues:

Firstly, is your site in maintenance mode? If I remember correctly, queues don't process jobs while the app is in maintenance mode.

Also, have you checked your job(s) to make sure that there aren't any errors that are showing up when the code is run on the server? If a job errors out, it will remain in the database table, which makes it seem as though the queue isn't running.

Since your app is working locally but not on the server, there are a few things that I immediately would want to check regarding potential points where your jobs could be failing:

  • Are you running the same version of PHP and MySQL on your local instance and the EC2 instance? Sometimes, certain things will work in your local version that doesn't work on the EC2's version, for example, class property types work with PHP 7.4, but not PHP 7.3).

  • Are your composer packages up to date on both your local machine and your EC2 instance? Again, sometimes packages can change their functionality from version to version, so if there have been a lot of updates between the version you're using locally and the version you're using on the EC2 instance, something could be getting called that doesn't exist in the EC2's version of the package.

  • Do you have the same PHP extensions installed on your local machine and on the EC2 instance? I know that, in the past, I've had to install specific PHP extensions for certain tasks (like rendering out a PDF) that aren't required for running Laravel by default. Usually what happens is that I forget to install the same extension on the EC2 instance, so I get an error on the instance that I haven't gotten before on my local because I've never tried to run the code without the PHP extension installed.

While you're checking the above items, something simple that I always forget to do is checking that your storage and bootstrap/cache have the correct permissions. If they don't, you could be getting errors, but Laravel is unable to actually put them in the logfile because it doesn't have permission to open the file for writing. Check here for another Laracasts post if you need the specific commands to add the correct permissions to those directories.

Try those things out and let me know if any of them solved your problem!

Please or to participate in this conversation.