Create and edit pages return error trim(): Argument #1 ($string) ...

Have a application that runs locally perfectly, but in production the create and edit pages return : trim(): Argument #1 ($string) must be of type string, array given it might have something to do with different frontend assets? Here my Flare error page: https://flareapp.io/share/NPLRYLr5 Any idea what I could try? Did the php artisan filament:upgrade and composer update and on the prod server composer install
Flare
trim(): Argument #1 ($string) must be of type string, array given - The error occurred at https://admin.telraam.net/clients/1142458/edit
Solution:
Ya, just delete your \resources\views\vendor\filament directory.
Jump to solution
14 Replies
davedriesmans
davedriesmansβ€’7mo ago
php artisan filament:upgrade on the server did the trick
hayvern
hayvernβ€’7mo ago
I'm getting the same error on a local project that ran fine on v3.0-stable. Did a composer update to v3.1.15 and I'm getting a "trim(): Argument #1 ($string) must be of type string, array given" error when accessing an entry in the Resource table. Error is pointing to: resources\views\vendor\filament\components\section.blade.php : 58 Action: I updated composer.json to use "3.1.15" followed by composer update. Don't know where to start checking... any ideas?
DrByte
DrByteβ€’7mo ago
resources\views\vendor\filament\components\section.blade.php : 58
Where did that file come from? That's coming from your app, as though you published the filament templates and now they're outdated?
hayvern
hayvernβ€’7mo ago
Thanks for the hint. I was mucking about with publishing assets early on in the project and I'm not fully aware about how the internal mechanism for Laravel/Filament works yet. I fixed the issue by: 1. Deleting the vendor folder. [Error goes away but form is wonky, missing components etc] 2. Ran: "php artisan vendor:publish --tag=filament-views --force" 3. php artisan cache:clear, php artisan view:clear, php artisan config:clear Issue is fixed now. Appreciate the reply!
DrByte
DrByteβ€’7mo ago
Filament normally recommends to NOT publish the views ... because these kinds of symptoms are what happens from that.
hayvern
hayvernβ€’7mo ago
Is there a way i can revert if that's the case?
Solution
DrByte
DrByteβ€’7mo ago
Ya, just delete your \resources\views\vendor\filament directory.
DrByte
DrByteβ€’7mo ago
Then it'll use the stuff from the /vendor/filament/... sub tree, which is managed by Composer, and updated when you run composer update (and composer update is probably already set to call filament:upgrade as one of its post-steps, which saves you running it manually every time)
hayvern
hayvernβ€’7mo ago
Okay great! I've done that and all is working. πŸ‘
DrByte
DrByteβ€’7mo ago
woot! ya, general rule with all projects: don't publish assets you don't need
hayvern
hayvernβ€’7mo ago
Roger that!
DrByte
DrByteβ€’7mo ago
Even in Filament there's been lots of times I've been tempted to publish a certain component template just to quickly alter it .... but I forced myself to find other ways, such as ->extraAttributes() and other things ... found via the docs, via lots of source-code-diving, and via help here in Discord
hayvern
hayvernβ€’7mo ago
I have no idea what I'm doing most of the time. Just too new with Laravel/Filament. But been loving it. Your help just sweetens it much more. Same here, I'm doc diving, running 2 instances at the same time to test stuff on my on-going project and a fresh one to see what works/breaks. 80% of the time is reading docs, 20% is coding actually.
DrByte
DrByteβ€’7mo ago
Ya, for sure. People around here are good to help. And I find the posts that get the best answers are those that contain good questions: good details, steps to recreate the problem, clear code examples (using github markdown "code" indicators, ie: 3-backticks to start/end code blocks, preferably even adding "php" to the opening one, so syntax highlighting is triggered), and screenshots of any visual issues so there's no ambiguity. Oh, and a Flareapp share URL if debugging an error.
Want results from more Discord servers?
Add your server
More Posts