cydrobolt / polr

:aerial_tramway: A modern, powerful, and robust URL shortener
https://polrproject.org
GNU General Public License v2.0
4.98k stars 892 forks source link

Weird 401 error when trying to load dashboard... Sometimes #408

Open emoyly opened 6 years ago

emoyly commented 6 years ago

Sometimes when i try to open my dashboard or settings, it just throws me this error. I have installed polr on another machine before, without any errors. I don't know if I'm just being dumb, or there's some weird bug somewhere.

Error

Expected Behavior

Successfully load the dashboard

Current Behavior

It throws this error: datatables warning: table id=admin_links_table - Ajax error. For more information about this error, please see http://datatables.net/tn/7

Steps to Reproduce (for bugs)

  1. Install polr
  2. That's it.

Your Environment

cydrobolt commented 6 years ago

Can you turn on debug mode as demonstrated in https://github.com/cydrobolt/polr/issues/239#issuecomment-253101748 and share the full error message?

emoyly commented 6 years ago

chrome_2018-01-29_20-40-08 This actually makes sense, since after it makes the error, it logs me out...

Here's the whole error in text format

HttpException in Application.php line 428:
User must be authenticated.
in Application.php line 428
at Application->abort('401', 'User must be authenticated.', array()) in helpers.php line 20
at abort('401', 'User must be authenticated.') in Controller.php line 48
at Controller::ensureLoggedIn() in AdminPaginationController.php line 155
at AdminPaginationController->paginateUserLinks(object(Request))
at call_user_func_array(array(object(AdminPaginationController), 'paginateUserLinks'), array(object(Request))) in Container.php line 507
at Container->call(array(object(AdminPaginationController), 'paginateUserLinks'), array()) in Application.php line 1399
at Application->callControllerCallable(array(object(AdminPaginationController), 'paginateUserLinks'), array()) in Application.php line 1363
at Application->callLumenController(object(AdminPaginationController), 'paginateUserLinks', array(true, array('as' => 'api_get_user_links', 'uses' => 'App\Http\Controllers\AdminPaginationController@paginateUserLinks'), array())) in Application.php line 1335
at Application->callControllerAction(array(true, array('as' => 'api_get_user_links', 'uses' => 'App\Http\Controllers\AdminPaginationController@paginateUserLinks'), array())) in Application.php line 1303
at Application->callActionOnArrayBasedRoute(array(true, array('as' => 'api_get_user_links', 'uses' => 'App\Http\Controllers\AdminPaginationController@paginateUserLinks'), array())) in Application.php line 1288
at Application->handleFoundRoute(array(true, array('as' => 'api_get_user_links', 'uses' => 'App\Http\Controllers\AdminPaginationController@paginateUserLinks'), array())) in Application.php line 1207
at Application->Laravel\Lumen\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 43
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 20
at VerifyCsrfToken->handle(object(Request), object(Closure))
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
at StartSession->handle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Application.php line 1439
at Application->sendThroughPipeline(array('Illuminate\Cookie\Middleware\EncryptCookies', 'Illuminate\Session\Middleware\StartSession', 'Illuminate\View\Middleware\ShareErrorsFromSession', 'App\Http\Middleware\VerifyCsrfToken'), object(Closure)) in Application.php line 1213
at Application->dispatch(null) in Application.php line 1153
at Application->run() in index.php line 28
cydrobolt commented 6 years ago

Does this error occur even if you log out, immediately log back in, and try to load the admin panel? What SESSION_DRIVER value are you using in .env? If you're using file, are your permissions for the storage folder correct?

What cookies are set on your browser for your site when the error occurs? Could you try in a different browser?

emoyly commented 6 years ago

Yeah it happens too if i log out and back in again immediately. I'm using file for the session driver. The storage folder has it's permissions set to 755, but it seems that some of the sessions have different permissions. filezilla_2018-01-29_21-06-20

emoyly commented 6 years ago

What seems to be the actual issue, is that the panel just logs me out sometimes, when i try to load the admin panel, which is what is causing the error.

overint commented 6 years ago

I also noticed this error when setting up a new site. Maybe we should show a more useful error, or redirect the user back to the login page?

prysme01 commented 5 years ago

also facing this issue, my storage permissions are the same

yjmp14 commented 4 years ago

I encountered the same issue and I've found out where the bug is and how to fix it. The default value of "_created_at" and "updated_at" fields in "users" table of the database are invaild. Just delete the two fields then re-create them with a vaild default value like "NULL_" will fix this issue.

Tchekda commented 3 years ago

Just delete the two fields then re-create them with a vaild default value like "NULL" will fix this issue.

Hi, I tried to do that but still not working : image

I've set max_input_vars = 10000 as the developer proposed some time ago

My nginx is correctly configured :

location / {
                index index.php;
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }

I've forced dbal < 2.10 and PHP < 7.4 to fix the Laravel bugs on setup.