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:
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...
Jump to solution
18 Replies
ruddy
ruddy14mo ago
Same here ,did you find the solution of this?
DrByte
DrByte14mo ago
Can you provide a gist with some example code. It'll be faster to debug if you provide a working example of the problem.
Maarten Paauw
Maarten Paauw14mo ago
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?
Donnell Wyche
Donnell WycheOP14mo ago
I did the same thing and added
$this->app->bind(Authenticatable::class, User::class);
$this->app->bind(Authenticatable::class, User::class);
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.
ruddy
ruddy14mo ago
Thanks. Adding it to the service provider works for me as well.
Maarten Paauw
Maarten Paauw14mo ago
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.
BlackShadow
BlackShadow14mo ago
Im encountering a similar problem but im not using multi tenancy.
Cannot use "::class" on value of type null {"exception":"[object] (TypeError(code: 0): Cannot use \"::class\" on value of type null at /Users/myname/Documents/Projects/ProjectName/vendor/filament/actions/src/Imports/Models/Import.php:43)
Cannot use "::class" on value of type null {"exception":"[object] (TypeError(code: 0): Cannot use \"::class\" on value of type null at /Users/myname/Documents/Projects/ProjectName/vendor/filament/actions/src/Imports/Models/Import.php:43)
Adding $this->app->bind(Authenticatable::class, User::class); seems to fix it.
Maarten Paauw
Maarten Paauw14mo ago
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...
BlackShadow
BlackShadow14mo ago
Nice 🙂
Maarten Paauw
Maarten Paauw14mo ago
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
Maarten Paauw
Maarten Paauw14mo ago
The app(Authenticatable::class) part.
BlackShadow
BlackShadow14mo ago
Yea i noticed this myself Atleast i can still test it with sync
Donnell Wyche
Donnell WycheOP14mo ago
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...
Maarten Paauw
Maarten Paauw14mo ago
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
Maarten Paauw
Maarten Paauw14mo ago
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...
Maarten Paauw
Maarten Paauw13mo ago
Yesterday Filament 3.1.9 was released with downgraded / fixed league/csv version and a small fix for strict models. Imports should work now.
BlackShadow
BlackShadow13mo ago
Awesome!
ruddy
ruddy13mo ago
👍

Did you find this page helpful?