In forge, failed jobs are trying to insert the failed job using the wrong database connection. I’m using MySQL but it was trying to insert into sql lite. Then it throws an exception since it can’t find the path to the file. I have MySQL as both database connection and have specifically set MySQL as my job connection. I have ran php artisan cache::clear, config:clear. That didn’t help. I’m unable to recreate the issue in dev. Any help would be appreciated
@Snapey Thanks for you response. i have ran the command you suggested. it shows the database connection is MYSQL:
MySQL ..................................................................................................................................... 8.0.35
Connection ................................................................................................................................. mysql
Here is the .env permission and ownership:
-rw-rw-r-- 1 forge forge 2276 Sep 26 08:54 .env
It sounds like your Laravel application is defaulting to the SQLite connection for your failed jobs table. This can happen if the configuration for the queue or database is not set correctly. Here are a few steps to troubleshoot and resolve this issue:
Check your .env file:
Ensure that your .env file has the correct database connection settings. Specifically, check the DB_CONNECTION and QUEUE_CONNECTION variables.
DB_CONNECTION=mysql
QUEUE_CONNECTION=database
Check your config/database.php file:
Make sure that the default connection is set to MySQL and that the MySQL connection settings are correct.
Clear the configuration cache:
Since you mentioned you already ran php artisan config:clear, also try clearing the cache and restarting the queue workers.
Check your queue worker configuration:
If you are using Supervisor to manage your queue workers, ensure that the configuration file for Supervisor is correctly set up to use the right environment variables.
Example Supervisor configuration (/etc/supervisor/conf.d/laravel-worker.conf):
Check for environment-specific configurations:
Ensure that there are no environment-specific configurations that might be overriding your settings. For example, check if there are any .env.production or .env.staging files that might be used in your Forge environment.
By following these steps, you should be able to ensure that your Laravel application uses the correct MySQL database connection for failed jobs. If the issue persists, double-check all configurations and consider restarting your server to ensure all changes take effect.