F
Filament8mo ago
jak888

getting 404 on livewire.min.js

Hi all, I'm getting the following error on my production site, when I try to access the /admin route: Failed to load resource: the server responded with a status of 404 () for the file livewire.min.js. This has previously been working and only happens on the production site. Why might this be happening?
24 Replies
Dennis Koch
Dennis Koch8mo ago
Seems like your server isn't set up correctly. I thinkt there are numerous questions and tutorials out there that handle that.
jak888
jak888OP8mo ago
Not set up correctly in what way? Was it set up correctly before, when it worked? Why does the same code running on the same server on the staging site not have this issue?
Dennis Koch
Dennis Koch8mo ago
This has previously been working and only happens on the production site.
Previously worked where? Local? That are different environments. It sounds like your server doesn't serve JS files via PHP
Why does the same code running on the same server on the staging site not have this issue?
Good question. Same settings for live and staging?
jak888
jak888OP8mo ago
Sorry, I understand how it can be misleading. The admin panel is not new, it has been running on production for a few months just fine. Now I get the above error on production. When I look for solutions, a lot of posts point to nginx issues, which I doubt, because I didn’t change anything dramatic and it’s still running on staging. It is still running locally and on staging. Which settings would I look for?
Dennis Koch
Dennis Koch8mo ago
Good question. Maybe try re installing vendor.
jak888
jak888OP8mo ago
How? FWIW, the vendor folders look the same on staging and production
Dennis Koch
Dennis Koch8mo ago
Is the 404 coming from server or Laravel?
jak888
jak888OP8mo ago
How can I tell? the error message says livewire.min.js:1
Dennis Koch
Dennis Koch8mo ago
Usually by the style of the error page. Laravel has a different style than nginx/apache. You can have a look at the DevTools network tab and preview/response of that request
jak888
jak888OP8mo ago
I see There's no error page only a black screen and a console error
Dennis Koch
Dennis Koch8mo ago
Can you share a screenshot of the part of your DevTools which I just explained?
jak888
jak888OP8mo ago
Do you mean this?
jak888
jak888OP8mo ago
No description
Dennis Koch
Dennis Koch8mo ago
Yes. But click on the failing request and then show Preview tab
jak888
jak888OP8mo ago
not very informative:
No description
Dennis Koch
Dennis Koch8mo ago
So probably no Laravel error but Server error. Anything inside Response? If not can you share just the Headers tab? Hm. I have no idea why this worked before and doesn't anymore. Usually it's some server setup thing. Hard to tell. Sorry.
jak888
jak888OP8mo ago
What else can I try?
Dennis Koch
Dennis Koch8mo ago
I'd start by checking whether livewire.js hits your public/index.php. You can check by adding a dd() in there and see it hits that file when you open livewire.js. If it doesn't, you need to check your server config. I know there is a thread on Livewire GitHub Discussion but I couldn't find it right now
jak888
jak888OP8mo ago
If it at least happened on all sites... OK, I "solved" it updated livewire to the latest version and deployed to produciton with a composer install. Seems to work now Now, of course I went from it working, through no identified root cause to it not working and then through no perceived change to it working again so I'll just add this to the list of things to keep me up at night Thanks for your patience!
awcodes
awcodes8mo ago
Possibly check your nginx config and make sure it’s not trying to serve livewire.js as a cached asset file. It needs to go through index.php to work appropriately.
jak888
jak888OP8mo ago
Yeah, that's what most of the topics I found online said, but it's doing nothing of the sort. I can't claim to understand much of this stuff, but at the most primitive level, I'd think that if 1) it works after updating 2) it works on staging it's not nginx related.
awcodes
awcodes8mo ago
That’s fair, but it still implies that there’s some difference between your staging and production server. The code base has no knowledge of the server environment. It just tries to run the code. There’s a lot of things it could be, but I’ve found that the nginx caching and serving of static css, js, and img files tends to be the root problem a majority of the time. On several of our servers I have to explicitly tell it to not serve anything under /livewire as a static asset. Because that asset is dynamically served and not an actual file at a given location.
jak888
jak888OP7mo ago
@awcodes OK, so the issue has been returning on and off. The weirdest thing just happened: I didn't see the problem, but my coleague saw it. We were on the site at the same time and I could access the admin panel just fine, while he got the 404. I can log in with his account just fine as well and he can with mine That last part doesn't even make sense, because the error already pops up on the login page for the admin site. Can you guide me in looking into this further? It worked for me on my windows laptop and two iphones. And for my colleague it worked again, once he rebooted. Can this be a client side issue?
awcodes
awcodes7mo ago
Honestly, I’m not sure. That is very unusual.
Want results from more Discord servers?
Add your server