1
votes

When I run php artisan queue:work on my local server, everything works fine, but on my production server, all queued jobs/notifications/mails fail.

It shows this error for my failed jobs:

exception 'ErrorException' with message 'include(/var/www/addondomains/mutual.ecowas.int/vendor/composer/../laravel/framework/src/Illuminate/Mail/SendQueuedMailable.php): failed to open stream: No such file or directory' in /var/www/....../vendor/composer/ClassLoader.php:444

or

exception 'InvalidArgumentException' with message 'View [email] not found.' in /var/www/....../vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137

If I change the queue_driver to SYNC, everything works fine. Otherwise, all fail.

Is there something I am missing?

3
I'm having the same issue. It started after I upgraded from Laravel 5.6 to 5.8. Sync code works fine, queued jobs throw the "View not found" exception. Tried different things like restart FPM, dump composer's autoload, clear app and views cache. Nothing worked. - Gustavo Straube

3 Answers

0
votes

In my case, restarting the queue workers fixed the issue. They had an uptime of 500 and something days. Therefore, old code was loaded on memory, leading to the inexplicable exceptions.

0
votes

The error says:

failed to open stream: No such file or directory' in /var/www/....../vendor/composer/ClassLoader.php

Probably you have missing dependencies. You should try to do a composer install on your production server and also check if the user running PHP has access to the folders (e.g. on Ubuntu it's usually www-data user).

Please log in to your production server and run composer install. And, if you are manually deploying, I also recommend you to user Jenkins or some tools like that, which can handle this kind of thing during deployments for you.

If this doesn't work, please post more info about your server version, etc so we can help you.

-2
votes

composer dump-autolaod

after changes in queue files