Search code examples
laravellaravel-livewire

Why redirecting to other page if user is not logged from Livewire mount method raised error?


On a Laravel/Livewire site I try to redirect to other page if user is not logged with message which I would show using Sweetalert library, like:

<?php

namespace App\Livewire\Admin;

use App\Library\Services\Interfaces\LoggedUserInterface;
use App\Models\User;
use Illuminate\Http\Request;
use Livewire\Component;

class MyComponent extends Component
{
    public int $taskId;
    protected LoggedUserInterface $loggedUserService;

    public function boot(LoggedUserInterface $loggedUserService)
    {
        $this->loggedUserService = $loggedUserService;
    }

    public function mount(Request $request, int $taskId)
    {
        if(!$this->loggedUserService->checkUserLogged()) { // my service
            request()->session()->flash('error', 'You need login to enter this page !');
            return $this->redirect(route('home'), navigate: true);

        }
        $this->taskId = $taskId;
        ...
    }

    public function render(Request $request)
    {

But I got error :

Object of class Livewire\Features\SupportRedirects\Redirector could not be converted to int

Why did I get this error and how it can be fixed ?

"laravel/framework": "^10.48.4",
"livewire/livewire": "^3.4.9",

Error details

Full error log is :

[2024-04-25 13:09:59] local.ERROR: Object of class Livewire\Features\SupportRedirects\Redirector could not be converted to int {"view":{"view":"/Projects/MyApp/resources/views/livewire/test.blade.php","data":[]},"exception":"[object] (Spatie\\LaravelIgnition\\Exceptions\\ViewException(code: 0): Object of class Livewire\\Features\\SupportRedirects\\Redirector could not be converted to int at /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1244)
[stacktrace]
#0 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1244): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(45): Illuminate\\Foundation\\Application->abort()
#3 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportRedirects/SupportRedirects.php(60): abort()
#4 /Projects/MyApp/vendor/livewire/livewire/src/ComponentHook.php(63): Livewire\\Features\\SupportRedirects\\SupportRedirects->dehydrate()
#5 /Projects/MyApp/vendor/livewire/livewire/src/ComponentHookRegistry.php(110): Livewire\\ComponentHook->callDehydrate()
#6 /Projects/MyApp/vendor/livewire/livewire/src/ComponentHookRegistry.php(73): Livewire\\ComponentHookRegistry::Livewire\\{closure}()
#7 /Projects/MyApp/vendor/livewire/livewire/src/EventBus.php(60): Livewire\\ComponentHookRegistry::Livewire\\{closure}()
#8 /Projects/MyApp/vendor/livewire/livewire/src/helpers.php(98): Livewire\\EventBus->trigger()
#9 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(57): Livewire\\trigger()
#10 /Projects/MyApp/vendor/livewire/livewire/src/LivewireManager.php(73): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->mount()
#11 /Projects/MyApp/resources/views/livewire/test.blade.php(32): Livewire\\LivewireManager->mount()
#12 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(37): include('...')
#13 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(38): App\\Livewire\\Test->Livewire\\Mechanisms\\ExtendBlade\\{closure}()
#14 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(72): Livewire\\Mechanisms\\ExtendBlade\\ExtendedCompilerEngine->evaluatePath()
#15 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(16): Illuminate\\View\\Engines\\CompilerEngine->get()
#16 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/View.php(207): Livewire\\Mechanisms\\ExtendBlade\\ExtendedCompilerEngine->get()
#17 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/View.php(190): Illuminate\\View\\View->getContents()
#18 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/View.php(159): Illuminate\\View\\View->renderContents()
#19 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(240): Illuminate\\View\\View->render()
#20 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(284): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->Livewire\\Mechanisms\\HandleComponents\\{closure}()
#21 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(232): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->trackInRenderStack()
#22 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(53): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->render()
#23 /Projects/MyApp/vendor/livewire/livewire/src/LivewireManager.php(73): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->mount()
#24 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportPageComponents/HandlesPageComponents.php(17): Livewire\\LivewireManager->mount()
#25 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportPageComponents/SupportPageComponents.php(118): Livewire\\Component->Livewire\\Features\\SupportPageComponents\\{closure}()
#26 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportPageComponents/HandlesPageComponents.php(14): Livewire\\Features\\SupportPageComponents\\SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration()
#27 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(46): Livewire\\Component->__invoke()
#28 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#29 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#30 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()
#31 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#32 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#34 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#35 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle()
#36 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#38 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#39 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#40 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\StartSession->handle()
#41 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#43 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#45 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then()
#47 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack()
#48 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute()
#49 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute()
#50 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#51 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#52 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#53 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#54 /Projects/MyApp/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#55 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#56 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#57 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#58 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#59 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#60 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#61 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#62 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#63 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#64 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#65 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#66 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#67 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle()
#68 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#69 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#70 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#71 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#72 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#73 /Projects/MyApp/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
#74 {main}

[previous exception] [object] (ErrorException(code: 0): Object of class Livewire\\Features\\SupportRedirects\\Redirector could not be converted to int at /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1244)
[stacktrace]
#0 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1244): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(45): Illuminate\\Foundation\\Application->abort()
#3 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportRedirects/SupportRedirects.php(60): abort()
#4 /Projects/MyApp/vendor/livewire/livewire/src/ComponentHook.php(63): Livewire\\Features\\SupportRedirects\\SupportRedirects->dehydrate()
#5 /Projects/MyApp/vendor/livewire/livewire/src/ComponentHookRegistry.php(110): Livewire\\ComponentHook->callDehydrate()
#6 /Projects/MyApp/vendor/livewire/livewire/src/ComponentHookRegistry.php(73): Livewire\\ComponentHookRegistry::Livewire\\{closure}()
#7 /Projects/MyApp/vendor/livewire/livewire/src/EventBus.php(60): Livewire\\ComponentHookRegistry::Livewire\\{closure}()
#8 /Projects/MyApp/vendor/livewire/livewire/src/helpers.php(98): Livewire\\EventBus->trigger()
#9 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(57): Livewire\\trigger()
#10 /Projects/MyApp/vendor/livewire/livewire/src/LivewireManager.php(73): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->mount()
#11 /Projects/MyApp/storage/framework/views/b798dad3b55153572acc9fbddd03b634.php(32): Livewire\\LivewireManager->mount()
#12 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(37): include('...')
#13 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(38): App\\Livewire\\Test->Livewire\\Mechanisms\\ExtendBlade\\{closure}()
#14 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(72): Livewire\\Mechanisms\\ExtendBlade\\ExtendedCompilerEngine->evaluatePath()
#15 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(16): Illuminate\\View\\Engines\\CompilerEngine->get()
#16 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/View.php(207): Livewire\\Mechanisms\\ExtendBlade\\ExtendedCompilerEngine->get()
#17 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/View.php(190): Illuminate\\View\\View->getContents()
#18 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/View.php(159): Illuminate\\View\\View->renderContents()
#19 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(240): Illuminate\\View\\View->render()
#20 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(284): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->Livewire\\Mechanisms\\HandleComponents\\{closure}()
#21 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(232): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->trackInRenderStack()
#22 /Projects/MyApp/vendor/livewire/livewire/src/Mechanisms/HandleComponents/HandleComponents.php(53): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->render()
#23 /Projects/MyApp/vendor/livewire/livewire/src/LivewireManager.php(73): Livewire\\Mechanisms\\HandleComponents\\HandleComponents->mount()
#24 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportPageComponents/HandlesPageComponents.php(17): Livewire\\LivewireManager->mount()
#25 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportPageComponents/SupportPageComponents.php(118): Livewire\\Component->Livewire\\Features\\SupportPageComponents\\{closure}()
#26 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportPageComponents/HandlesPageComponents.php(14): Livewire\\Features\\SupportPageComponents\\SupportPageComponents::interceptTheRenderOfTheComponentAndRetreiveTheLayoutConfiguration()
#27 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(46): Livewire\\Component->__invoke()
#28 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#29 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#30 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(806): Illuminate\\Routing\\Route->run()
#31 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#32 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#34 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#35 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle()
#36 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#38 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#39 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#40 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\StartSession->handle()
#41 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#42 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#43 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#44 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#45 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#46 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then()
#47 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack()
#48 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute()
#49 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute()
#50 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch()
#51 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#52 /Projects/MyApp/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#53 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#54 /Projects/MyApp/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#55 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#56 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#57 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#58 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#59 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#60 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#61 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#62 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#63 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#64 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#65 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#66 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#67 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle()
#68 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#69 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#70 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#71 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then()
#72 /Projects/MyApp/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#73 /Projects/MyApp/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle()
#74 {main}
"}

a) What I paid attention at that MyComponent I use is never referenced at all.

b) view file is rather big, but after I cut all content from it I got the same error

c) Are there some online livewire playground to repeat the error online ?


Solution

  • With Livewire redirects must be performed on the browser side. In a Livewire class $this->redirect() is a helper to automate this process.

    Instead of:

    return $this->redirect(route('home'), navigate: true);
    

    use

    $this->redirect(route('home'), navigate: true);