© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
3 replies
David Majoulian

502 Bad Gateway Error on Laravel Vapor

Hi there, recently I pushed my project via Laravel Vapor to production but I quickly realized that I'm receiving a "502 Bad Gateway" error on a very critical javascript file (app.js) of Filament.

I've been trying to solve this issue but I can't seem to be able to. See the attachment of the error I'm receiving.

Now what I understood up to this point is that Laravel Vapor uploads the assets found in the public directory to CDN and serves the files from there. But that's not the case for Filament's app.js file found at
/vendor/filament/filament/dist
/vendor/filament/filament/dist
because Filament serves its app.js file within its vendor directory rather than from the public directory of Laravel.

I also tried the following as well and it didn't work:
1. Copy the
dist
dist
folder to the public directory so that Laravel Vapor uploads it CDN and then
2. Add the following piece of code into the
boot
boot
method of my
AppServiceProvider
AppServiceProvider
class:

Filament::serving(function() {
    Filament::registerScripts([asset('PATH_TO_THE_APPJS_FILE_IN_THE_PUBLIC_DIRECTORY')]);
});
Filament::serving(function() {
    Filament::registerScripts([asset('PATH_TO_THE_APPJS_FILE_IN_THE_PUBLIC_DIRECTORY')]);
});


Didn't work! The file was loaded with no 502 error BUT the filament was constantly returning 404 errors. Example: If i went to https://DOMAIN/admin it aborts with 404. And when i revert back the above mentioned changes, everything works again apart from the loading of the app.js file.

So.... i'm not sure how to proceed now....
Screenshot_2024-02-14_at_8.39.37_AM.png
Solution
Never mind, problem solved by upgrading Filament to v3.
Filament v3 handles assets in the way that Laravel Vapor wants; aka, it publishes its assets to the public directory by default.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

502 Bad Gateway Table polling
FilamentFFilament / ❓┊help
13mo ago
Laravel Vapor gzip
FilamentFFilament / ❓┊help
3y ago
ExportAction 502 Bad Gateway in Staging/Production
FilamentFFilament / ❓┊help
3y ago
File Uploads with Laravel Vapor
FilamentFFilament / ❓┊help
3y ago