bilfeldt / laravel-route-statistics

Log requests and group together for aggregated statistics of route usage
MIT License
227 stars 23 forks source link

Driver [routestat] not supported. #27

Closed eelco2k closed 9 months ago

eelco2k commented 9 months ago

Subject of the issue

After adding the middleware on Kernel.php or my default filament panel ->middleware([])

for all other panels were i add the middleware i get this error that driver 'routestat' is not supported.

eelco2k commented 9 months ago

After some debugging i found out that in Illuminate\Support\Manager.php in method createDriver() has a check:

if (isset($this->customCreators[$driver])) {}

but my $this->customCreators is empty, which shouldn't. it should hold the 'routestat' => Closure

bilfeldt commented 9 months ago

@eelco2k are you using the middleware class or an alias? If you are using an alias then you need to register that yourself.

eelco2k commented 9 months ago

No full namespace with classname

bilfeldt commented 9 months ago

Please post the entire error you get including stack trace.

eelco2k commented 9 months ago
[2024-01-23 19:28:59] local.ERROR: Driver [routestat] not supported. {"userId":1,"exception":"[object] (InvalidArgumentException(code: 0): Driver [routestat] not supported. at ./laravel-filament/vendor/laravel/framework/src/Illuminate/Support/Manager.php:109)
[stacktrace]
#0 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Support/Manager.php(80): Illuminate\\Support\\Manager->createDriver('routestat')
#1 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Support\\Manager->driver('routestat')
#2 ./laravel-filament/vendor/bilfeldt/laravel-request-logger/src/Listeners/LogRequest.php(29): Illuminate\\Support\\Facades\\Facade::__callStatic('driver', Array)
#3 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(478): Bilfeldt\\RequestLogger\\Listeners\\LogRequest->handle(Object(Illuminate\\Foundation\\Http\\Events\\RequestHandled))
#4 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(286): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}('Illuminate\\\\Foun...', Array)
#5 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(266): Illuminate\\Events\\Dispatcher->invokeListeners('Illuminate\\\\Foun...', Array, false)
#6 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Events\\Dispatcher->dispatch('Illuminate\\\\Foun...')
#7 ./laravel-filament/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#8 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(16): require_once('/Users/eelco/Ph...')
#9 {main}
"} 

not sure if this is full stack trace

eelco2k commented 9 months ago

maybe some extra information, i also use the other package you made: https://github.com/bilfeldt/laravel-request-logger

and there i cán use for every filament panel the middleware like so:

->persistentMiddleware(['requestlog'])

But that package does not use the ::extend() method

bilfeldt commented 9 months ago

Hmm.. What puzzles me is where the routestat driver request is coming from. The alias for the middleware is routestatistics (see here).

Are you using the string routestat somewhere in your codebase?

bilfeldt commented 9 months ago

Ahh.. @eelco2k are you using the macro $request->routeStatistics()? It seems like there is a bug there: https://github.com/bilfeldt/laravel-route-statistics/blob/534d1fb68ff178221efaedf62f9eabcecd551cbc/src/LaravelRouteStatisticsServiceProvider.php#L87

eelco2k commented 9 months ago

no I only enabled the middleware with full classname: \Bilfeldt\LaravelRouteStatistics\Http\Middleware\RouteStatisticsMiddleware::class

but in the handle() this $request->routeStatistics() is getting called.

and no i have searched for the string "routestat" in my entire project and it's only used in LaravelRouteStatisticsServiceProvider.php on lines:

$this->enableLog('routestat'); and RequestLoggerFacade::extend('routestat', function ($app) {

eelco2k commented 9 months ago

this ::extend loads the driver in Illuminate\Support\Manager.php $this->customCreators array,

But when the Macro is executed, and eventually goes into the createDriver($driver) function, the if (isset($this->customCreators[$driver])) { is empty.

and yes this is correct the: if (method_exists($this, $method)) { should be false (cause it's a customCreators[$driver]). so that is why it throws the error...

eelco2k commented 9 months ago

I saw some other strange thing:

In the macro('enableLog' which gets created in your other package: laravel-request-logger -> RequestLoggerServiceProvider.php -> Request::macro('enableLog' ...

I logged the following:

\Log::debug([$loggers, $drivers, RequestLoggerFacade::driver('routestat')]);

which gave me this result below:

I am using an own slight modified Model, but at that point there is the routstat driver registered. and i can request the driver via the RequestLoggerFacade, but the connection and tatble are both NULL. not sure if that is correct....

  local.DEBUG: array (
  0 => 
  array (
  ),
  1 => 
  array (
    0 => 'routestat',
  ),
  2 => 
  \App\Models\LaravelRouteStatistics\RouteStatistic::__set_state(array(
     'connection' => NULL,
     'table' => NULL,
     'primaryKey' => 'id',
     'keyType' => 'int',
     'incrementing' => true,
     'with' => 
    array (
    ),
     'withCount' => 
    array (
    ),
     'preventsLazyLoading' => false,
     'perPage' => 15,
     'exists' => false,
     'wasRecentlyCreated' => false,
     'escapeWhenCastingToString' => false,
     'attributes' => 
    array (
    ),
     'original' => 
    array (
    ),
     'changes' => 
    array (
    ),
     'casts' => 
    array (
      'date' => 'datetime',
    ),
     'classCastCache' => 
    array (
    ),
     'attributeCastCache' => 
    array (
    ),
     'dateFormat' => NULL,
     'appends' => 
    array (
    ),
     'dispatchesEvents' => 
    array (
    ),
     'observables' => 
    array (
    ),
     'relations' => 
    array (
    ),
     'touches' => 
    array (
    ),
     'timestamps' => false,
     'usesUniqueIds' => false,
     'hidden' => 
    array (
    ),
     'visible' => 
    array (
    ),
     'fillable' => 
    array (
    ),
     'guarded' => 
    array (
      0 => 'id',
    ),
  )),
)  
eelco2k commented 9 months ago

i've got another stack trace:

ocal.ERROR: Driver [routestat] not supported. {"userId":1,"exception":"[object] (InvalidArgumentException(code: 0): Driver [routestat] not supported. at ./laravel-filament/vendor/laravel/framework/src/Illuminate/Support/Manager.php:109)
[stacktrace]
#0 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Support/Manager.php(80): Illuminate\\Support\\Manager->createDriver('routestat')
#1 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Support\\Manager->driver('routestat')
#2 ./laravel-filament/vendor/bilfeldt/laravel-request-logger/src/RequestLoggerServiceProvider.php(62): Illuminate\\Support\\Facades\\Facade::__callStatic('driver', Array)
#3 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Macroable/Traits/Macroable.php(123): Illuminate\\Http\\Request->Bilfeldt\\RequestLogger\\{closure}()
#4 ./laravel-filament/vendor/bilfeldt/laravel-request-logger/src/Middleware/LogRequestMiddleware.php(19): Illuminate\\Http\\Request->__call('enableLog', Array)
#5 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Bilfeldt\\RequestLogger\\Middleware\\LogRequestMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#6 ./laravel-filament/vendor/filament/filament/src/Http/Middleware/DispatchServingFilamentEvent.php(15): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#7 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Filament\\Http\\Middleware\\DispatchServingFilamentEvent->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#8 ./laravel-filament/vendor/bezhansalleh/filament-language-switch/src/Http/Middleware/SwitchLanguageLocale.php(23): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#9 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): BezhanSalleh\\FilamentLanguageSwitch\\Http\\Middleware\\SwitchLanguageLocale->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#10 ./laravel-filament/vendor/filament/filament/src/Http/Middleware/DisableBladeIconComponents.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#11 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Filament\\Http\\Middleware\\DisableBladeIconComponents->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#12 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#13 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#14 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#15 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#16 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php(60): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#17 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\AuthenticateSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#18 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(57): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#19 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Auth\\Middleware\\Authenticate->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#20 ./laravel-filament/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#21 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#22 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#23 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#24 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#25 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#27 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#28 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 ./laravel-filament/vendor/stancl/tenancy/src/Middleware/IdentificationMiddleware.php(36): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 ./laravel-filament/vendor/stancl/tenancy/src/Middleware/InitializeTenancyBySubdomain.php(51): Stancl\\Tenancy\\Middleware\\IdentificationMiddleware->initializeTenancy(Object(Illuminate\\Http\\Request), Object(Closure), 'lemmens')
#31 ./laravel-filament/vendor/stancl/tenancy/src/Middleware/InitializeTenancyByDomainOrSubdomain.php(22): Stancl\\Tenancy\\Middleware\\InitializeTenancyBySubdomain->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#32 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Stancl\\Tenancy\\Middleware\\InitializeTenancyByDomainOrSubdomain->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#33 ./laravel-filament/vendor/stancl/tenancy/src/Middleware/PreventAccessFromCentralDomains.php(29): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#34 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Stancl\\Tenancy\\Middleware\\PreventAccessFromCentralDomains->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#35 ./laravel-filament/vendor/filament/filament/src/Http/Middleware/SetUpPanel.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#36 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Filament\\Http\\Middleware\\SetUpPanel->handle(Object(Illuminate\\Http\\Request), Object(Closure), Object(Filament\\Panel))
#37 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#38 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Routing/Router.php(805): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#39 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Routing/Router.php(784): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#40 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#41 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Routing/Router.php(737): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#42 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#43 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#44 ./laravel-filament/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#45 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#46 ./laravel-filament/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#47 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#51 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#52 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#53 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(99): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#60 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#61 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#62 ./laravel-filament/vendor/bilfeldt/laravel-correlation-id/src/Middleware/ClientRequestIdMiddleware.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#63 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Bilfeldt\\CorrelationId\\Middleware\\ClientRequestIdMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#64 ./laravel-filament/vendor/bilfeldt/laravel-correlation-id/src/Middleware/CorrelationIdMiddleware.php(26): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#65 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Bilfeldt\\CorrelationId\\Middleware\\CorrelationIdMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#66 ./laravel-filament/vendor/bilfeldt/laravel-route-statistics/src/Http/Middleware/RouteStatisticsMiddleware.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#67 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Bilfeldt\\LaravelRouteStatistics\\Http\\Middleware\\RouteStatisticsMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#68 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#69 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#70 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#71 ./laravel-filament/public/index.php(51): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#72 ./laravel-filament/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(16): require_once('/...')
#73 {main}
bilfeldt commented 9 months ago

I am sorry, but from the above description, the situation is not clear to me. Can you reproduce this in a new Laravel installation in order to narrow down what can cause this?

eelco2k commented 9 months ago

Will do!

eelco2k commented 9 months ago

I narrowed it down and it has to do with the Stancl/Tenancy package, specifically in this file https://github.com/archtechx/tenancy/blob/3.x/src/Bootstrappers/CacheTenancyBootstrapper.php

in the config file of stancl/tenancy --> tenancy.php there is a list of 'bootstrappers', when i disable the boostrapper: Stancl\Tenancy\Bootstrappers\CacheTenancyBootstrapper::class

Everything works as espected.!

bilfeldt commented 9 months ago

Good to hear @eelco2k 👍 Clearing the resolved facades (singletons) will cause this problem yes.

EngHell commented 3 months ago

@bilfeldt was a fix for this even submitted? I have a similar setup with stancl/tenancy that causes this issue, I'm using 2.2.0 as we are in Laravel 10, We can't remove this bootstrapper as our application relies on our cache layers.

bilfeldt commented 3 months ago

@bilfeldt was a fix for this even submitted? I have a similar setup with stancl/tenancy that causes this issue, I'm using 2.2.0 as we are in Laravel 10, We can't remove this bootstrapper as our application relies on our cache layers.

I don't see this as a bug. This is expected behavior if you clear the resolved singletons.

If you have a suggested fix for this, then I am all ears.

EngHell commented 2 months ago

@bilfeldt Thanks for your reply, and sorry for replying late, I had to focus on something else.

As a user of the tenancy package, I'm not 100% familiar with its internal working.

Could you illuminate me a bit on the resolved singletons that are being cleared? I want to work out on a solution, I'm currently looking for a package to log the usage of our routes to find stale code. This may be something that can be ironed out with the archtechx/tenancy team.

bilfeldt commented 2 months ago

@EngHell I am not familiar with that package I am afraid, and not sure how (if possible) to avoid the clearing of the singletons.

You can try to override the the constructor and descructor of the https://github.com/bilfeldt/laravel-request-logger/blob/main/src/RequestLogger.php class and then log when it is being created and destructed. My guess is that the tenecy package clears this but does not boot the system again, hence does not register the new driver again.

If that is the case, then you can surely somehow ask the package to re-register the drivers, but not sure how that is best done.