ImportAction Infinite Loop when using the new FilamentPHP 3.1 Import Action
Created an Importer, ran it, then got a flood of failed jobs because of this error in the vendor/filament/actions/src/Imports/Models/Import.php file on line 43:
Cannot use "::class" on value of type null
array:1 [▶
"exception" => TypeError {#4305▶
#message: "Cannot use "::class" on value of type null"
#code: 0
#file: "vendor/filament/actions/src/Imports/Models/Import.php"
#line: 43
}
]
I'm using Laravel 10.34.2, PHP 8.2.12, Filament 3.1 with Multi-tenancy. As best I can tell, this function isn't resolving the User model as the Authenticatable class.
---
My User model is
class User extends Authenticatable implements FilamentUser, HasAvatar, HasTenants
Solution:Jump to solution
Alright! league/csv version 9.12 broke the importer. I'm not entirely sure why. See issue https://github.com/filamentphp/filament/issues/10002 for more information. Maybe someone here can help us figure out
GitHub
ImportAction cannot be used in combination with an async queue dri...
Package filament/filament Package Version v3.1.0 Laravel Version 10.34.2 Livewire Version 3.2.1 PHP Version 8.2.12 Problem description When using the new CSV import action in combination with an as...
18 Replies
Same here ,did you find the solution of this?
Can you provide a gist with some example code. It'll be faster to debug if you provide a working example of the problem.
I've encountered the same problem. I'm using filament v3.1 and multi tenacy as well.
I'd add
$this->app->bind(Authenticatable::class, User::class);
to a service provider which (i think) fixed the problem. But I don't think that's a good solution.
It would be better if the importer uses the defined authGuard at panel level. What do you think?I did the same thing and added to a service provider and this worked. I just spun up a fresh FilamentPHP installation and the ImportAction worked flawlessly. So, I will add multi-tenancy and see where it fails. Grateful to know that I wasn't the only person who had this experience.
Thanks. Adding it to the service provider works for me as well.
Good to know this kinda temporary fix works. But still, it doesn’t feel right for me. It should know already which user to use in my opinion. Keep me posted on the multi tenancy part.
Im encountering a similar problem but im not using multi tenancy.
Adding
$this->app->bind(Authenticatable::class, User::class);
seems to fix it.I've created a GitHub issue for this bug with a reproduce branch: https://github.com/filamentphp/filament/issues/10002
GitHub
ImportAction cannot be used in combination with an async queue dri...
Package filament/filament Package Version v3.1.0 Laravel Version 10.34.2 Livewire Version 3.2.1 PHP Version 8.2.12 Problem description When using the new CSV import action in combination with an as...
Nice 🙂
Oh by the way, I don't know if it is clear already. The import action works using
QUEUE_DRIVER=sync
, but if you use a async driver like redis in combination with Horizon the following code https://github.com/filamentphp/filament/blob/3.x/packages/actions/src/Imports/Models/Import.php#L43 resolves to NULL.GitHub
filament/packages/actions/src/Imports/Models/Import.php at 3.x · fi...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
The
app(Authenticatable::class)
part.Yea i noticed this myself
Atleast i can still test it with sync
A fix was offered in this latest fix.
https://github.com/filamentphp/filament/releases/tag/v3.1.8
While the error is gone, so is my ability to import anything. It doesn't trigger a job any longer, so nothing happens on import. I will try to replicate on a fresh installation.
GitHub
Release v3.1.8 · filamentphp/filament
What's Changed
Update 08-grouping.md by @doczork in #10005
Finnish translation update by @Zagna in #10012
Fix layout break in notification for long words by @kainiklas in #10010
Update 02-over...
Hi man! I'm trying to implement the new update as well. I've the exact same thing. Error is gone, but the job isn't executing
I've updated my reproduction branch with import morphs
Hope someone figures out what's going on.
I tried to debug it for the last hour, nothing found yet,
Solution
Alright! league/csv version 9.12 broke the importer. I'm not entirely sure why. See issue https://github.com/filamentphp/filament/issues/10002 for more information. Maybe someone here can help us figure out
GitHub
ImportAction cannot be used in combination with an async queue dri...
Package filament/filament Package Version v3.1.0 Laravel Version 10.34.2 Livewire Version 3.2.1 PHP Version 8.2.12 Problem description When using the new CSV import action in combination with an as...
Yesterday Filament 3.1.9 was released with downgraded / fixed league/csv version and a small fix for strict models. Imports should work now.
Awesome!
👍