F
Filament8mo ago
MikeG

Desperately trying to fix gateway timeout on central filament panels

Hey Everyone! Im super stuck on an issue. For some reason both my central admin panels (multi-tenant through https://tenancyforlaravel.com/ are timeing out running on Vapor. I've added a middleware that should log something, but it's not logging anything. All routes on the panel are failing so it seems to not be something specific model related. I've been stuck on this for over 2 months now. I have 4 panels in total, 2 of them are in the tenant scope, and their working fine. It's the 2 on my central domain that are failing. I've tried everything I can think of. Their very basic panels with nothing added to them. Its working fine locally and on my dev server, but not on production. Does anyone have any debugging tips to fix this? Additional Info: - The login screen works, only after logging in this starts to fail - I've included the panel code in the commenets below
Tenancy for Laravel
Automatic & flexible multi-tenancy package for Laravel.
Automatically turn any Laravel application multi-tenant — no code changes needed. stancl/tenancy automatically switches database connections and all other things in the background, letting you leverage standard Laravel code into a full SaaS application. Most features out of all multi-tenancy packages. Single & multi-database tenancy.
Solution:
Fixed the issue, was completely not related to filament.. I adapted the base template view on my application which created a specific edge case...
Jump to solution
11 Replies
toeknee
toeknee8mo ago
Install telescope it should log the requests and allow you to debug what's happening... ensure to remove it once debugged
MikeG
MikeGOP8mo ago
We already have telescope, doesnt even hit it.. We're using Laravel Vapor, also no hit on any AWS logs Just times out after the aws API gateway timeout limit Only on these 2 panels though on the central domain, the 2 endpoints (login & register) that don't use filament work fine It's causing big damage and headache as our its our main admin panel & affiliate marketing portals that are down 😦 Just cant seem to figure this one out due to basically not logging opportunities If it helps:
public function panel(Panel $panel): Panel
{
return $panel
->id('partner')
->path('partner')
->authGuard('partner')
->colors([
'primary' => Color::Amber,
])
->brandName('Partners')
->login()
->discoverResources(in: app_path('Filament/Partner/Resources'), for: 'App\\Filament\\Partner\\Resources')
->discoverPages(in: app_path('Filament/Partner/Pages'), for: 'App\\Filament\\Partner\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Partner/Widgets'), for: 'App\\Filament\\Partner\\Widgets')
->widgets([
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
public function panel(Panel $panel): Panel
{
return $panel
->id('partner')
->path('partner')
->authGuard('partner')
->colors([
'primary' => Color::Amber,
])
->brandName('Partners')
->login()
->discoverResources(in: app_path('Filament/Partner/Resources'), for: 'App\\Filament\\Partner\\Resources')
->discoverPages(in: app_path('Filament/Partner/Pages'), for: 'App\\Filament\\Partner\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Partner/Widgets'), for: 'App\\Filament\\Partner\\Widgets')
->widgets([
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
Oh, also, IT DOES hit login. Only after logging in it will fail (doesnt matter which resource you visit)
toeknee
toeknee8mo ago
@MikeG put dumps everywhere then in telescope you can see the dumps hit, this will then let you trace it down to the function which is halting everything.
MikeG
MikeGOP7mo ago
So i'v made a middleware and set it at the very beginning, somehow that's not even being hit Any other debugging ideas by any chance? I've ran out of options @toeknee and am desperate 😂
toeknee
toeknee7mo ago
Could go back to basic error_log and debug the boot steps to see where it’s failing. Obviously you can try sentry.io too
MikeG
MikeGOP7mo ago
Ye we use Sentry, which also doesnt pick it up 😭 It seems completely infrastructure related because of it just not picking up any of the logging, but its weird that it only happens when your logged in and only on these 2 filament panels that are on our central domain and does not impact any of our tenant aware panels Thx for replying btw ❤️ really appriciate it
toeknee
toeknee7mo ago
Ok so in that case, check the middleware’s in place in the admin panel, also in the admin panels what’s the difference if records? Wondering if MySQL is running away or stuck in a loop. If you test with the same dataset locally does it work?
MikeG
MikeGOP7mo ago
Ye so this is also a rabbit hole i've gone down. Mainly because, on our dev server (using the exact same infra) its working fine (both those central panels). Its only broken on Production Our production data is much larger ofcourse, so it must be something related to SQL. But then again, if I remove all resources on the panel, it still doesnt work. So its not coming from a resource And as you can see from this code above, its just a normal panel :/ I dont see anything that would truely be querying SQL. Perhaps authenticate? @toeknee Ok you've already been major help ❤️ You gave me the idea to hook up my local machine to the data on the production server Locally, I AM able to load up the admin panel even with the production database So its not related to the data itself perse You'd think it would be fully infrastructure related, but then again, if I hit those routes when im not authenticated, it works fine (i.e it goes to the filament login page for that panel) ... And its working fine on Dev which is the EXACT same infra setup (through Laravel Vapor)
Solution
MikeG
MikeG7mo ago
Fixed the issue, was completely not related to filament.. I adapted the base template view on my application which created a specific edge case...
MikeG
MikeGOP7mo ago
Thank you for getting me on the right path @toeknee ❤️
toeknee
toeknee7mo ago
Well done bud
Want results from more Discord servers?
Add your server