F
Filamentβ€’2y ago
Stevee

v2.17.35 problem on windows

Hai, I just updated my projects to .35 but my admin panel is only show blank page, however it happen to 2 of 3 of my projects that use filament and this only happen at my env (windows, laragon), my friend that using mac os is not getting the problem. tested to downgrade to .34 and it's working normally
64 Replies
Dan Harrin
Dan Harrinβ€’2y ago
hey i know this is a problem but i cant reproduce it @andrewwallo please continue your debugging here @stevee94 im gonna need you to dig into what exactly is different about these projects compared to your others plugins, custom scripts, other customizations you may have made
Andrew Wallo
Andrew Walloβ€’2y ago
Okay, yeah cause I’m using Laragon on Windows as well
Dan Harrin
Dan Harrinβ€’2y ago
yeah but you tried it on a new project?
Andrew Wallo
Andrew Walloβ€’2y ago
Yes new project it is fine
Dan Harrin
Dan Harrinβ€’2y ago
and also Steve said it worked for one of his projects too? so maybe its not Laragon there must be a common demoninator here i just don’t understand what it is things like this that break the entire admin dont happen often, they are usually reproducanle
Andrew Wallo
Andrew Walloβ€’2y ago
Session database?
Dan Harrin
Dan Harrinβ€’2y ago
try clearing your session maybe but i doubt it idk why that would affect js
Stevee
SteveeOPβ€’2y ago
yap, and the all 3 projects use similar plugins, scripts, etc
Dan Harrin
Dan Harrinβ€’2y ago
can you share any of the apps that might be easy for me to set up locally
Andrew Wallo
Andrew Walloβ€’2y ago
Branch 1.x of ERPSAAS Let me get the link one sec
Andrew Wallo
Andrew Walloβ€’2y ago
GitHub
GitHub - andrewdwallo/erpsaas at 1.x
Contribute to andrewdwallo/erpsaas development by creating an account on GitHub.
Andrew Wallo
Andrew Walloβ€’2y ago
You don't need to, but just letting you know that I made a database seeder for it:
public function run(): void
{
User::factory()
->withPersonalCompany()
->create([
'name' => 'Your Name',
'email' => '[email protected]',
'password' => bcrypt('your-password'),
'current_company_id' => 1,
]);

$company_id = 1;
User::factory(18)
->withPersonalCompany()
->create([
'password' => bcrypt('password'),
'current_company_id' => $company_id,
])->each(static function (User $user, $index) use ($company_id) {
$role = $index % 2 === 0 ? 'editor' : 'admin';
$user->companies()->attach($company_id, ['role' => $role]);
});
public function run(): void
{
User::factory()
->withPersonalCompany()
->create([
'name' => 'Your Name',
'email' => '[email protected]',
'password' => bcrypt('your-password'),
'current_company_id' => 1,
]);

$company_id = 1;
User::factory(18)
->withPersonalCompany()
->create([
'password' => bcrypt('password'),
'current_company_id' => $company_id,
])->each(static function (User $user, $index) use ($company_id) {
$role = $index % 2 === 0 ? 'editor' : 'admin';
$user->companies()->attach($company_id, ['role' => $role]);
});
You just need to input your info here just for a quick setup, but not needed at all But its 4:00AM where I live so I will be back here tomorrow to figure it out...
Marco Mapelli
Marco Mapelliβ€’2y ago
filament update 2.17.35 error caught SyntaxError: Unexpected token '}' (
Dan Harrin
Dan Harrinβ€’2y ago
scroll up, i cant reproduce the problem please help me.
Marco Mapelli
Marco Mapelliβ€’2y ago
How ?
Dan Harrin
Dan Harrinβ€’2y ago
create a reproduction repository i have tried installing filament in a new project and it worked for me @andrewwallo i just installed epssaas 1.x, updated Filament to .35, and it works
Andrew Wallo
Andrew Walloβ€’2y ago
Very weird then Cause it’s the exact same project I have
Dan Harrin
Dan Harrinβ€’2y ago
yeah
Andrew Wallo
Andrew Walloβ€’2y ago
I guess windows then?
Dan Harrin
Dan Harrinβ€’2y ago
sure, but i dont understand why
Andrew Wallo
Andrew Walloβ€’2y ago
Yeah me neither
Dan Harrin
Dan Harrinβ€’2y ago
i cant see anything that has changed 😭
Andrew Wallo
Andrew Walloβ€’2y ago
has sortable.js been updated recently?
Dan Harrin
Dan Harrinβ€’2y ago
uh i dont know @cerelli can you find the AssetController.php file in /vendor you see the line that says ->send() if you remove that, does it work?
Marco Mapelli
Marco Mapelliβ€’2y ago
Yes
Marco Mapelli
Marco Mapelliβ€’2y ago
Zep Fietje
Zep Fietjeβ€’2y ago
ok @danharrin my guess was right then
Dan Harrin
Dan Harrinβ€’2y ago
so this is the fix? ok thanks
Zep Fietje
Zep Fietjeβ€’2y ago
let's revert that pr
Dan Harrin
Dan Harrinβ€’2y ago
GitHub
Do not send unnecessary headers when pretending to be a file by lin...
This PR enhances the handling of Set-Cookie headers, which Laravel typically includes in every request. By preventing these headers, files can more effectively simulate being the requested assets. ...
Zep Fietje
Zep Fietjeβ€’2y ago
Thanks for the swift help everyone here!
Andrew Wallo
Andrew Walloβ€’2y ago
Glad issue was found πŸ‘
Marco Mapelli
Marco Mapelliβ€’2y ago
Thanks!
Dan Harrin
Dan Harrinβ€’2y ago
I've released a new version @andrewwallo @cerelli @stevee94
Andrew Wallo
Andrew Walloβ€’2y ago
Sounds good
Stevee
SteveeOPβ€’2y ago
ehmm still not fix on my side still blank page
Dan Harrin
Dan Harrinβ€’2y ago
please run php artisan about which filament version are you on
Stevee
SteveeOPβ€’2y ago
v2.17.36 ohh looks its my cache, sorry
Marco Mapelli
Marco Mapelliβ€’2y ago
I upgraded to v2.17.36 and now everything works. Thanks.
Stevee
SteveeOPβ€’2y ago
okay, work now, thank u guys
Dan Harrin
Dan Harrinβ€’2y ago
thanks
Zep Fietje
Zep Fietjeβ€’2y ago
awesome!
Andrew Wallo
Andrew Walloβ€’2y ago
Weird mine doesn’t work after upgrading and everything, with still same error, but since it seems others are working maybe it’s browser cache idk
Zep Fietje
Zep Fietjeβ€’2y ago
Could you try clearing your browser cache?
Andrew Wallo
Andrew Walloβ€’2y ago
Yeah
Zep Fietje
Zep Fietjeβ€’2y ago
Hmm, try different browser
Crylar
Crylarβ€’2y ago
This could be due some non-filament assets that got no version query string prefix on their css, js files and these got cached by CF causing some problems for some people. πŸ™‚ I had no problems in production but I am not using many of 3rd party plugins too. πŸ™‚
Dan Harrin
Dan Harrinβ€’2y ago
this isnt a CF issue its a problem with Laragon on Windows locally
Crylar
Crylarβ€’2y ago
I see. I have never used Laragon.
Dan Harrin
Dan Harrinβ€’2y ago
neither, so i had a hard time replicating this bug
Andrew Wallo
Andrew Walloβ€’2y ago
I reset computer and everything, it works now!
Crylar
Crylarβ€’2y ago
I might check though. It would be nice to have CF caching enabled. I guess ln into filament dist might be a workaround to enable CF caching for now. πŸ™‚
Zep Fietje
Zep Fietjeβ€’2y ago
Classic fix! Haha, glad it works now
Andrew Wallo
Andrew Walloβ€’2y ago
Probably something to do with either Apache or Nginx
Zep Fietje
Zep Fietjeβ€’2y ago
Well, go to sleep now, Andrew πŸ˜†
Andrew Wallo
Andrew Walloβ€’2y ago
Haha yeah sound good
exactwebitesolutions
Out of interest does anybody know why this happens? What does Laragon do differently?
Crylar
Crylarβ€’2y ago
Probably some windows wizardry. I will need to try and see though. The only difference was that files were not sending Set-Cookie headers anymore and acted more like real static files. :)) It should be something windows related but this works in Laragon when you terminate the response right after headers and content is sent. I will do some further testing and maybe we can retry this PR @danharrin ?
response()
->file($path, [
'Content-Type' => $contentType,
'Expires' => $this->getHttpDate($expires),
'Cache-Control' => $cacheControl,
'Last-Modified' => $this->getHttpDate($lastModified),
])
->send();

exit();
response()
->file($path, [
'Content-Type' => $contentType,
'Expires' => $this->getHttpDate($expires),
'Cache-Control' => $cacheControl,
'Last-Modified' => $this->getHttpDate($lastModified),
])
->send();

exit();
Dan Harrin
Dan Harrinβ€’2y ago
hmm right its weird though isnt it
Crylar
Crylarβ€’2y ago
Indeed, but I think when it's not terminated on windows you get a malformed output for JS with error in a console that leads to what people here seen. πŸ™‚
return response()
->file($path, [
'Content-Length' => filesize($path),
'Content-Type' => $contentType,
'Expires' => $this->getHttpDate($expires),
'Cache-Control' => $cacheControl,
'Last-Modified' => $this->getHttpDate($lastModified),
])
->send();
return response()
->file($path, [
'Content-Length' => filesize($path),
'Content-Type' => $contentType,
'Expires' => $this->getHttpDate($expires),
'Cache-Control' => $cacheControl,
'Last-Modified' => $this->getHttpDate($lastModified),
])
->send();
but if I add Content-Length header this looks to work properly. I will test on my other machines too and if it's good will resubmit PR. πŸ™‚ I do believe it's because Laragon works on HTTP 1.1 and you need to send Content-Length to clearly define when to end the receiving, otherwise Laravel probably adds some extra bits and makes the received file malformed. I guess HTTP 2 works differently, and that's why me and you have not seen this when testing on our machines. So both ways work - terminating right after content and headers are sent or clearly defining content-length. Technically, we could just terminate, as there is no real reason for us to pass response through other middlewares for Laravel. Sending the content-length header is optional in HTTP/2. See section 8.1.2.6 of RFC 7540: "A request or response that includes a payload body can include a content-length header field." The header is not required since HTTP/2 includes sufficient information in the frame headers for a user agent to determine when a resource has been sent in full. Yeh so the cause is HTTP/1.1
Crylar
Crylarβ€’2y ago
https://github.com/filamentphp/filament/pull/6426 for your judgement. PR added Accepted-Ranges and Content-Length headers for HTTP/1.1 users but these will be auto-discarded by a server using HTTP/2. Right after we send headers and content the process is terminated as there is no need for any further processing by Laravel.
GitHub
Do not send unnecessary headers when pretending to be a file by lin...
PR #6407 improvement with fixes for HTTP/1.1 users.
Andrew Wallo
Andrew Walloβ€’2y ago
I've had problems beforehand with Apache and Filament before the error occurred yesterday, but then I changed to Nginx a couple of weeks ago and it has been a much better experience than before. Just because I am curious, I wanted to ask, what is the purpose of the AssetController.php file? I am curious because I usually see things such as "Expires, Cache-Control, Content-Length, etc..." that would usually be configured not in the Laravel application itself, but in the local server's configuration files. Could this not possibly cause conflicts?
Dan Harrin
Dan Harrinβ€’2y ago
in v2, you dont need to publish any css or js to your /public directory to be able to use Filament this is because we instead use the AssetController to trick the browser into thinking that the files exist, when in reality they are just controller responses Livewire does the same thing in v3 weve gotten rid of the asset controller and you just have a command to publish assets instead.
Andrew Wallo
Andrew Walloβ€’2y ago
Okay sounds good, was just wondering. Thanks!
Want results from more Discord servers?
Add your server