You have to upgrade the jenssegers/laravel-mongodb package to 3.3.* as well. You can see that on the package page: https://github.com/jenssegers/laravel-mongodb
MongoDbSessionHandler error is getting after update laravel version from 5.4 to 5.5
I have a project in laravel 5.4. I am currently using mongodb. I am using "https://github.com/jenssegers/laravel-mongodb" for laravel and mongodb interaction. I have updated laravel version 5.5. When I login to my system. I am getting error. I did laravel version update correctly. I don't know why this error getting. Please help me.
LogicException
Session name cannot be empty, did you forget to call "parent::open()" in "Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler"?.
@bobbybouwmann, I have updated the package but same error is getting
"require": {
"php": ">=7.0.0",
"barryvdh/laravel-dompdf": "^0.8.0",
"fideloper/proxy": "~3.3",
"jenssegers/mongodb": "^3.3",
"jenssegers/mongodb-session": "^1.1",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"predis/predis": "^1.1",
"yajra/laravel-datatables-oracle": "~8.0"
},
I have no clue what it can be. I suggest to dive into the code of the package. It looks like it's calling a class from symfony which is not correct. But that can also be in your project.
I have just changed the below database -
//'default' => 'mysql', 'default' => 'mongodb', ===Function Code==
protected function addCookieToResponse($request, $response) { $config = config('session');
$response->headers->setCookie(
new Cookie(
'XSRF-TOKEN', $request->session()->token(), $this->availableAt(60 * $config['lifetime']),
$config['path'], $config['domain'], $config['secure'], false, false, $config['same_site'] ?? null
)
);
return $response;
}
Then after this it shows the below error
(1/1) ErrorException Trying to get property 'headers' of non-object
in VerifyCsrfToken.php line 158 at HandleExceptions->handleError(8, 'Trying to get property 'headers' of non-object', 'E:\xampp\htdocs\automobile_mongo\application\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php', 158, array('request' => object(Request), 'response' => null, 'config' => array('driver' => 'database', 'lifetime' => 120, 'expire_on_close' => false, 'encrypt' => true, 'files' => 'E:\xampp\htdocs\automobile_mongo\application\storage\framework/sessions', 'connection' => null, 'table' => 'sessions', 'store' => null, 'lottery' => array(2, 100), 'cookie' => 'laravel_session', 'path' => '/', 'domain' => null, 'secure' => false, 'http_only' => true)))in VerifyCsrfToken.php line 158 at VerifyCsrfToken->addCookieToResponse(object(Request), null)in VerifyCsrfToken.php line 67 at VerifyCsrfToken->handle(object(Request), object(Closure))in Pipeline.php line 149 at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request))in ShareErrorsFromSession.php line 49 at ShareErrorsFromSession->handle(object(Request), object(Closure))in Pipeline.php line 149 at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request))in StartSession.php line 65 at StartSession->handle(object(Request), object(Closure))in Pipeline.php line 149 at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request))in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))in Pipeline.php line 149 at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request))in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure))in Pipeline.php line 149 at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request))in Pipeline.php line 102 at Pipeline->then(object(Closure))in Router.php line 660 at Router->runRouteWithinStack(object(Route), object(Request))in Router.php line 635 at Router->runRoute(object(Request), object(Route))in Router.php line 601 at Router->dispatchToRoute(object(Request))in Router.php line 590 at Router->dispatch(object(Request))in Kernel.php line 176 at Kernel->Illuminate\Foundation\Http{closure}(object(Request))in Pipeline.php line 30 at Pipeline->Illuminate\Routing{closure}(object(Request))in CheckForMaintenanceMode.php line 46 at CheckForMaintenanceMode->handle(object(Request), object(Closure))in Pipeline.php line 149 at Pipeline->Illuminate\Pipeline{closure}(object(Request))in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request))in Pipeline.php line 102 at Pipeline->then(object(Closure))in Kernel.php line 151 at Kernel->sendRequestThroughRouter(object(Request))in Kernel.php line 116 at Kernel->handle(object(Request))in index.php line 59
@stardesign041@gmail.com I can't read this at all.. Please follow the markdown guidelines for posting something: https://help.github.com/articles/basic-writing-and-formatting-syntax/
Also please create a new thread if you have a question!
Please or to participate in this conversation.