Laravel worker issue: it tries to connect to db using forge@localhost

Hi,

When checking my Laravel scheduler logs I found out that it’s trying to connect to the database using, what I think is, the default user in Laravel projects (forge), thus bypassing the db connection variables in my .env file. N.B.: The db connection is working properly for the rest, or else the app would just not run (and it does run properly for the most part).

The sequence in the logs ends up with a TaskScheduler fail.

Any idea on how to fix that? The scheduler is running workers on the same user as the IN app, if that matters.

Thanks

In Connection.php line 760:
                                                                               
  SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using pa  
  ssword: YES) (SQL: select * from information_schema.tables where table_sche  
  ma = forge and table_name = accounts and table_type = 'BASE TABLE')                                                                                         

In Connector.php line 70:                                                                            

  SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using pa  
  ssword: YES)                                                                                                                                                

  2023-01-22 14:15:04 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:15:04 App\Jobs\Ninja\QueueSize ................... 9.79ms DONE
  2023-01-22 14:20:02 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:20:02 App\Jobs\Ninja\QueueSize ................... 8.78ms DONE
  2023-01-22 14:25:02 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:25:02 App\Jobs\Ninja\QueueSize ................... 7.46ms DONE
  2023-01-22 14:30:02 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:30:02 App\Jobs\Ninja\QueueSize ................... 2.87ms DONE
  2023-01-22 14:30:02 App\Jobs\Subscription\CleanStaleInvoiceOrder ... RUNNING
  2023-01-22 14:30:02 App\Jobs\Subscription\CleanStaleInvoiceOrder  18.39ms DONE
  2023-01-22 14:35:03 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:35:03 App\Jobs\Ninja\QueueSize ................... 2.73ms DONE
  2023-01-22 14:40:03 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:40:03 App\Jobs\Ninja\QueueSize ................... 2.96ms DONE
  2023-01-22 14:45:05 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:45:05 App\Jobs\Ninja\QueueSize ................... 6.05ms DONE
  2023-01-22 14:50:03 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:50:03 App\Jobs\Ninja\QueueSize ................... 3.98ms DONE
  2023-01-22 14:55:02 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 14:55:02 App\Jobs\Ninja\QueueSize .................. 15.06ms DONE
  2023-01-22 15:00:02 App\Jobs\Util\ReminderJob ...................... RUNNING
  2023-01-22 15:00:03 App\Jobs\Util\ReminderJob ................. 19.22ms DONE
  2023-01-22 15:00:03 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 15:00:03 App\Jobs\Ninja\QueueSize ................... 4.81ms DONE
  2023-01-22 15:05:03 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 15:05:03 App\Jobs\Ninja\QueueSize ................... 5.37ms DONE
  2023-01-22 15:10:03 App\Jobs\Ninja\QueueSize ....................... RUNNING
  2023-01-22 15:10:03 App\Jobs\Ninja\TaskScheduler ................... RUNNING
  2023-01-22 15:10:03 App\Jobs\Ninja\QueueSize ................... 3.69ms DONE
  2023-01-22 15:10:03 App\Jobs\Ninja\TaskScheduler .............. 18.36ms FAIL

In Connection.php line 760:
                                                                               
  SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using pa  
  ssword: YES) (SQL: select * from information_schema.tables where table_sche  
  ma = forge and table_name = accounts and table_type = 'BASE TABLE')

Hi,

@david any ideas?

This is a non-impacting bug as this class isn’t being used yet. I’ll have a fix for this in the next release.

1 Like