Back

New Forge App, Undefined Index 'Table'


Hi! I just deployed my first Laravel app, built using Homestead on Ubuntu 18, to an AWS server via Forge, and I can't get beyond http status 500 internal server error:

production.ERROR: Undefined index: table (View: /home/forge/default/resources/views/welcome.blade.php) at /home/forge/default/vendor/laravel/framework/src/Illuminate/Auth/CreatesUserProviders.php:71

which is contained in function:

protected function createDatabaseProvider($config) { $connection = $this->app['db']->connection(); return new DatabaseUserProvider($connection, $this->app['hash'], $config['table']); }

App works fine on my Ubuntu laptop. I followed the Forge video instruction series to GitHub repository deployment, and I verified that my DB exists on the server, albeit with empty tables. My 'welcome' view doesn't conduct any DB interaction. I changed my mysql database config to the user and password sent when the server was provisioned, but still get the internal server error. Lots of Google and Stack Overflow searching to no avail--seems I'm the only one to have this particular problem...

I'd really appreciate any advice! I spent the bulk of my last 8 months of free time on a Laravel 5.7 app, and it's really bumming me out that I can't get it deployed.

Thanks!

Cameron replied 2 weeks ago

Does the .env have the proper credentials for your database ?

If so did you manually remove or edit migrations ? You may have to truncate your migrations table on the forge server and re run php artisan migrate but be sure to clear all caches after you truncate

TorchSK replied 2 weeks ago Solution

Try to add this to User.php model class

protected $table = "users";

or add table index to app/config/auth.php:

    'providers' => [
        'users' => [
            ....
            ....
            'table'  => 'users', // **This was missing**
        ],
    ],

Daniel Price replied 2 weeks ago

Thanks, folks--TorchSK's last suggestion was what I tried first and it worked! I did tweak my migration files--didn't actually use them for development--so I likely have work to do there, too, Cameron. Awesome resource, this forum, I hope I learn enough to contribute soon. Thanks again!


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us