F
Filament6mo ago
pjb

Chart Widgets behind load balancer throw RootTagMissingFromViewException

I have a few standard bar chart widgets on the default dashboard. They all load successfully in a single-server environment. When I put my application behind a load balancer (multiple server instances, no sticky sessions), multiple livewire/update requests fail with:
Livewire encountered a missing root tag when trying to render a component. When rendering a Blade view, make sure it contains a root HTML tag.
Livewire encountered a missing root tag when trying to render a component. When rendering a Blade view, make sure it contains a root HTML tag.
If I turn on sticky sessions in my load balancer or reduce the number of server instances to 1, the problem goes away. I also do not receive the error in my single container development environment. I've tested deploying with/without php artisan optimize and/or php artisan filament:optimize It seems like any request that goes through the load balancer and is handled by an instance other than the one that handled the initial page load is failing. Appreciate any ideas/assistance!
3 Replies
Matthew
Matthew6mo ago
What is your cache mode. I think if you are on file, you must have sticky sessions to work livewire. It apparently will work with Redis\Memcache without sticky sessions.
pjb
pjbOP6mo ago
Thanks @Matthew , we have both SESSION_DRIVER and CACHE_DRIVER set to redis and confirmed that they are working as expected
pjb
pjbOP6mo ago
In case anybody else comes across this thread, this appears to be the problem: https://github.com/livewire/livewire/pull/4354
GitHub
Fix Livewire requests across load balancers by calebporzio · Pull ...
The Problem: Currently, if a Livewire app is served across load balancers, the following situation may occur: A user loads a page with a Livewire component (that contains child Livewire components...

Did you find this page helpful?