Upgrade to Filament v3

Hello, guys. I've made the upgrade to Filament v3 but I have this error. How can I solve it?
No description
32 Replies
Dennis Koch
Dennis Koch10mo ago
What PHP Version are you using?
DianaMujoiu
DianaMujoiu10mo ago
8.1.23 and Laravel 10.23.0
toeknee
toeknee10mo ago
are you sure php cli is 8.1? run: php artisan about
DianaMujoiu
DianaMujoiu10mo ago
No description
DianaMujoiu
DianaMujoiu10mo ago
I ran this command before upgrading the filament. Now if I run it, I get the above error this is the version from composer for filament "filament/filament": "^3.0-stable", Any idea?
toeknee
toeknee10mo ago
delete your vendor folder then run composer install
DianaMujoiu
DianaMujoiu10mo ago
same error I commented this line // App\Providers\Filament\AdminPanelProvider::class, in app.config. The error disappeard, but the admin have 404 error now
toeknee
toeknee10mo ago
Check the config
DianaMujoiu
DianaMujoiu10mo ago
filament.config or app.config?
DianaMujoiu
DianaMujoiu10mo ago
this is the app config I think the error is related to this path " ->discoverResources(in: app_path('Filament/Resources'), for: 'App\Filament\Resources') ->discoverPages(in: app_path('Filament/Pages'), for: 'App\Filament\Pages')" When I delete or change, the error disappears. Any idea, please? 😄
Patrick Boivin
Patrick Boivin10mo ago
When I delete or change, the error disappears
What did you change exactly? Can you show an example that works and an example that doesn't?
DianaMujoiu
DianaMujoiu10mo ago
if I put the path like this
->discoverResources(in: app_path('app/Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('app/Filament/Pages'), for: 'App\\Filament\\Pages')
->discoverResources(in: app_path('app/Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('app/Filament/Pages'), for: 'App\\Filament\\Pages')
I don't have any errors but I only see the dashboard, not the resources. And when I put the path like this
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
I have this error "Only arrays and Traversables can be unpacked"
DianaMujoiu
DianaMujoiu10mo ago
and this is the structure
No description
Patrick Boivin
Patrick Boivin10mo ago
Makes sense, I think the first one is giving paths like /my/project/app/app/Filament/Resources (double app), that don't exist
I have this error "Only arrays and Traversables can be unpacked"
Can you click SHARE at the top of the error page, and share the URL here? Oh, this is in the console... can you get to this error in the Browser?
DianaMujoiu
DianaMujoiu10mo ago
Flare
Only arrays and Traversables can be unpacked - The error occurred at https://st-martin-api.graffino.dev/admin
Patrick Boivin
Patrick Boivin10mo ago
Does this happen after login? Like it's trying to show the Dashboard page?
DianaMujoiu
DianaMujoiu10mo ago
Yes
Patrick Boivin
Patrick Boivin10mo ago
Can you get any other page to load by visiting the direct URL? like /admin/posts
DianaMujoiu
DianaMujoiu10mo ago
I have the same error Maybe is something wrong with the folder structure?
Patrick Boivin
Patrick Boivin10mo ago
I think it looks fine, in your screenshot 👆 If you open the site in an incognito tab, can you access the login form?
DianaMujoiu
DianaMujoiu10mo ago
No description
Patrick Boivin
Patrick Boivin10mo ago
php artisan about -> which Filament version?
DianaMujoiu
DianaMujoiu10mo ago
No description
Patrick Boivin
Patrick Boivin10mo ago
This is very weird 😔 Can you share your composer.json?
Patrick Boivin
Patrick Boivin10mo ago
Running out of ideas, hehe Can you do a search in your codebase for $routeMiddleware. Is there anything that modifies this variable on your pages?
DianaMujoiu
DianaMujoiu10mo ago
I don't have this in Kernel
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
and also I have this in a resource protected static string|array $routeMiddleware = 'base';
Patrick Boivin
Patrick Boivin10mo ago
It's fine in Kernel, I'm thinking about your Filament code specifically. This could be it, can you try $routeMiddleware = ['base'];
DianaMujoiu
DianaMujoiu10mo ago
I found the problem.... I deleted this line and it works...protected static string|array $routeMiddleware = 'base'; and it's also working with your code 🙏🏻
DianaMujoiu
DianaMujoiu10mo ago
Thank you so much!
Patrick Boivin
Patrick Boivin10mo ago
You're welcome 🙌