F
Filament6mo ago
btx

New Custom Page 404

Hi, I created a new custom page (the first one) in my project using php artisan make:filament-page QueueDashboard. However the page is not reachable, and not showing up in the sidebar. Using route:list shows the route
GET|HEAD admin/queue-dashboard .............................................................................................................................................................................................................. filament.admin.pages.queue-dashboard › App\Filament\Pages\QueueDashboard
GET|HEAD admin/queue-dashboard .............................................................................................................................................................................................................. filament.admin.pages.queue-dashboard › App\Filament\Pages\QueueDashboard
But when I call /admin/queue-dashboard, I get 404. Whats wrong ?? 😓 The Class has the following content:
<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;

class QueueDashboard extends Page {
protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.queue-dashboard';

protected ?string $heading = 'Custom Page Heading';

protected static ?string $navigationLabel = 'Custom Navigation Label';

public static function canAccess(): bool {
return true;
}
}
<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;

class QueueDashboard extends Page {
protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.queue-dashboard';

protected ?string $heading = 'Custom Page Heading';

protected static ?string $navigationLabel = 'Custom Navigation Label';

public static function canAccess(): bool {
return true;
}
}
55 Replies
LeandroFerreira
LeandroFerreira6mo ago
Is there a ->discoverPages(...) in the AdminPanelProvider?
btx
btxOP6mo ago
@Leandro Ferreira yes, its there ->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
LeandroFerreira
LeandroFerreira6mo ago
weird, this page should show in the sidebar any Filament customizations?
Dennis Koch
Dennis Koch6mo ago
Do you have a Pages Resource? Hm. But shouldn't conflict as it doesn't have a /pages prefix in the URL
btx
btxOP6mo ago
@Dennis Koch I think no I noticed, there is also a ->pages([Pages\Dashboard::class]) in AdminPanelProvider, but commenting or adding the page also didn't help. Also tried all variants of cache:clear, optimize:clear ...
No description
Dennis Koch
Dennis Koch6mo ago
Can you add a mount method with a dd() inside to check whether the page is not found or maybe any model your trying to load?
btx
btxOP6mo ago
Added it but it doesn't get triggerd. When I try to add it manually in the ->pages() or call ->url(), there is an exception
No description
No description
LeandroFerreira
LeandroFerreira6mo ago
any Filament customizations? appserviceprovider, custom menu..?
btx
btxOP6mo ago
@Leandro Ferreira not really :/
No description
LeandroFerreira
LeandroFerreira6mo ago
php artisan about --only=Filament what is the filament version?
btx
btxOP6mo ago
c4c632e68af4:/app# php artisan about --only=Filament

Filament .........................................................................................................................................
Packages ......................................................................................... filament, forms, notifications, support, tables
Version .................................................................................................................................. v3.2.94
Views .............................................................................................................................. NOT PUBLISHED
c4c632e68af4:/app# php artisan about --only=Filament

Filament .........................................................................................................................................
Packages ......................................................................................... filament, forms, notifications, support, tables
Version .................................................................................................................................. v3.2.94
Views .............................................................................................................................. NOT PUBLISHED
LeandroFerreira
LeandroFerreira6mo ago
could you share the AdminProvider file?
btx
btxOP6mo ago
<?php

namespace App\Providers\Filament;

class AdminPanelProvider extends PanelProvider {
public function panel(Panel $panel): Panel {
Table::configureUsing(function (Table $table): void {
$table->paginationPageOptions([10, 25, 50, 100]);
});

return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Lime,
])
->viteTheme('resources/css/filament/admin/theme.css')
->maxContentWidth(MaxWidth::ScreenTwoExtraLarge)
->brandName('MyApp')
->favicon(asset('images/favicon.png'))
->brandLogo(asset('images/logo2.png'))
->darkModeBrandLogo(asset('images/logo-dark2.png'))
// ->brandLogoHeight('42px')
->brandLogoHeight('32px')
->font('Asap')
->globalSearchKeyBindings(['command+k', 'ctrl+k'])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->pages([Pages\Dashboard::class])
->navigationGroups([
NavigationGroup::make()->label('Inventory'),
NavigationGroup::make()->label('Administration'),
NavigationGroup::make()->label('Settings'),
NavigationGroup::make()->label('Hidden')->collapsed(),
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([Authenticate::class]);
}
}
<?php

namespace App\Providers\Filament;

class AdminPanelProvider extends PanelProvider {
public function panel(Panel $panel): Panel {
Table::configureUsing(function (Table $table): void {
$table->paginationPageOptions([10, 25, 50, 100]);
});

return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Lime,
])
->viteTheme('resources/css/filament/admin/theme.css')
->maxContentWidth(MaxWidth::ScreenTwoExtraLarge)
->brandName('MyApp')
->favicon(asset('images/favicon.png'))
->brandLogo(asset('images/logo2.png'))
->darkModeBrandLogo(asset('images/logo-dark2.png'))
// ->brandLogoHeight('42px')
->brandLogoHeight('32px')
->font('Asap')
->globalSearchKeyBindings(['command+k', 'ctrl+k'])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->pages([Pages\Dashboard::class])
->navigationGroups([
NavigationGroup::make()->label('Inventory'),
NavigationGroup::make()->label('Administration'),
NavigationGroup::make()->label('Settings'),
NavigationGroup::make()->label('Hidden')->collapsed(),
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([Authenticate::class]);
}
}
LeandroFerreira
LeandroFerreira6mo ago
ok, I think any routes/web.php customization? did you try to add this page in some navgroup protected static ?string $navigationGroup = 'Administration' ?
Dennis Koch
Dennis Koch6mo ago
in my project using php artisan make:filament-page QueueDashboard.
Can you try this with any other page and check whether it works?
btx
btxOP6mo ago
I removed all routes from web.php, also added the $navigationGroup, still not showing and 404 :/ I deleted the QueueDashboard page and created a new one "Hello", same result
Dennis Koch
Dennis Koch6mo ago
Can your create a fresh project, install filament and create a page to check that that works. Any route that might collide with the page? Can you maybe share the full route list?
btx
btxOP6mo ago
I'll try it later
btx
btxOP6mo ago
Dennis Koch
Dennis Koch6mo ago
What happened to admin/queue-dashboard?
btx
btxOP6mo ago
i deleted it, replaced it with hello. Thought possibly a name collision because of "dashboard"
LeandroFerreira
LeandroFerreira6mo ago
I believe this is a customization that you did... did you upgrade from v2 or is it a v3 installation?
btx
btxOP6mo ago
It's a new project, started with v3 back in January. It has not much frontend code, mainly backend processing and Laravel Horizon
LeandroFerreira
LeandroFerreira6mo ago
are you able to share this project on github? 99% a fresh Filament install will work
btx
btxOP6mo ago
It's still on Laravel 10 if that's possibly relevant
LeandroFerreira
LeandroFerreira6mo ago
no, it was supposed to work are you using plugins?
btx
btxOP6mo ago
"awcodes/filament-addons": "^0.3.14", "codewithdennis/filament-select-tree": "^3.1", "filament/filament": "^3.0-stable", "filament/forms": "^3.0-stable", "filament/notifications": "^3.0-stable", "filament/tables": "^3.0-stable", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.10", "laravel/horizon": "^5.24", "laravel/octane": "*", "laravel/sanctum": "^3.3", "laravel/tinker": "^2.8", "league/flysystem-aws-s3-v3": "^3.0", "league/glide-laravel": "^1.0", "opcodesio/log-viewer": "^3.1", "osiemsiedem/intervention-image-vips-driver": "^0.11.0", "predis/predis": "^2.0", "ralouphie/mimey": "^1.0", "shuchkin/simplexlsx": "^1.0", "spatie/temporary-directory": "^2.2", "spiral/roadrunner-cli": "^2.6.0", "spiral/roadrunner-http": "^3.3.0" Roadrunner is installed, but app is running in fpm Docker container
LeandroFerreira
LeandroFerreira6mo ago
maybe you could provide a min repo on Github to reproduce this issue
btx
btxOP6mo ago
Ok, now I get the same behavior with a fresh installation. I'll upload it in a minute
btx
btxOP6mo ago
GitHub
GitHub - btxtiger/laravel-filament-404-bug
Contribute to btxtiger/laravel-filament-404-bug development by creating an account on GitHub.
awcodes
awcodes6mo ago
Are you getting the laravel 404 page or the server 404 page.?
btx
btxOP6mo ago
laravel 404
awcodes
awcodes6mo ago
I’m not seeing anything standing out to me.
btx
btxOP6mo ago
The issue appeared in both, Docker nginx php fpm and also local artisan serve
awcodes
awcodes6mo ago
Can you rollback filament one version at a time to see if a recent release might have broken something. Does it work if you manually register the page in the ->pages() modifier?
btx
btxOP6mo ago
Downgraded until 3.2.39 (maximum possible), same issue Also adding to pages() has no effect
No description
awcodes
awcodes6mo ago
Highly unusual. The code looks good to me. I have custom pages working fine on 3.2.92. I’m leaning toward it being something in your sever, maybe permissions on the directory. Not sure. Do resources work? Just having a hard time figuring out why the route is registered but laravel is throwing the 404. Just doesn’t make sense.
btx
btxOP6mo ago
I got it working digging into HasComponents.php and commenting this section:
No description
No description
btx
btxOP6mo ago
However how can I still have cached Components after running cache:clear, optimize:clear, view:clear ?
LeandroFerreira
LeandroFerreira6mo ago
your repo is working here
No description
awcodes
awcodes6mo ago
Ah, cached components in filament are different than normal laravel optimization. php artisan filament:clear-cached-components
btx
btxOP6mo ago
I guess that was the issue 👍 thanks everyone for helping!! One last question: Shouldn't it be possibly a default behavior to clear this component cache automatically after creating a new page, to prevent running into such issue? I never actively cached any component, never read of this command before tbh
awcodes
awcodes6mo ago
They don’t cache by default. So if you didn’t run the command then they shouldn’t have been cached.
LeandroFerreira
LeandroFerreira6mo ago
weird because it is a fresh install, right?
awcodes
awcodes6mo ago
My thought too.
btx
btxOP6mo ago
yes, was a fresh installation, new dir, using laravel new ...
awcodes
awcodes6mo ago
Did you run optimize? I wonder if there’s a tie in that will run the component cache on optimize.
btx
btxOP6mo ago
no not as I remember, I tend to run optimize:clear to prevent any issues in dev env
awcodes
awcodes6mo ago
Yea. Really odd. Not seeing anything in the code that would run it without calling it specifically either. Oh well, glad you figured it out.
btx
btxOP6mo ago
possibly running php artisan filament:install --panels ? idk. I'll let you know if I find it 😄
awcodes
awcodes6mo ago
Please do, but I’ve never had this happen in any of my apps.
LeandroFerreira
LeandroFerreira6mo ago
me too 😅
awcodes
awcodes6mo ago
But to answer your earlier question, it doesn’t need to be cleared automatically when creating a new page because it shouldn’t be cached in dev. And, if you need it, should only be part of your deploy script, which would only run after you’ve pushed be code to the server anyway. Thank you for being patient with all this though. And sticking with filament. I’m sure it’s been a troublesome day to say the least.
Reza Daulay
Reza Daulay6mo ago
great, thx. i had same issue, and same solution.
Want results from more Discord servers?
Add your server