Skip to content

Publish Filament assets on every composer install - #398

Merged
Cannonb4ll merged 1 commit into
mainfrom
fix/publish-filament-assets-on-install
Nov 25, 2026
Merged

Cannonb4ll merged 1 commit into
mainfrom
fix/publish-filament-assets-on-install

Conversation

@Cannonb4ll

Copy link
Copy Markdown
Member

Fixes #396

Problem

Uploading an image in the markdown editor fails with:

Uncaught ReferenceError: $saveUploadedFileAttachmentAndGetUrl is not defined

The code is fine; the published Filament JS on the server is stale. public/js/filament is gitignored and only gets republished by filament:upgrade / filament:assets. In this repo filament:upgrade was only in post-update-cmd, which runs on composer update, not on the composer install that deployments use.

On roadmap.ploi.io, js/filament/schemas/schemas.js is still the build from 25 Oct (4015 bytes). That version of filamentSchemaComponent doesn't expose schema component methods, while Filament 5.11 renders the markdown editor calling $saveUploadedFileAttachmentAndGetUrl(). The ?v=5.11.0.0 query string comes from the installed composer version, not the file contents, so the old file looks current. support.js, notifications.js and tabs.js are also out of date there.

Fix

Move @php artisan filament:upgrade from post-update-cmd to post-autoload-dump, as the Filament deployment docs recommend. Every composer install now republishes the assets.

Verification

Tested locally in the browser as an admin:

  • With current assets, image upload works in the comment form, the inline reply form and the action modal.
  • With the production schemas.js swapped in locally, the upload throws exactly the error from the issue.
  • After running composer dump-autoload, the file is republished from vendor and the upload works again.

After merging

The next deploy fixes production. To fix it right away, run php artisan filament:assets on the server.

roadmap:upgrade also calls filament:assets, but as its last step, after the migrations. So the deploy either doesn't run it or stopped before that step. The deploy log is worth checking.

filament:upgrade only ran on composer update, so deployments using
composer install kept serving the previously published Filament JS.
The stale schemas.js lacks the exposed schema component methods that
Filament 5.11 renders, which breaks markdown editor image uploads with
"$saveUploadedFileAttachmentAndGetUrl is not defined".

Move it to post-autoload-dump, as the Filament deployment docs advise.
@Cannonb4ll
Cannonb4ll merged commit 775fcb1 into main Nov 25, 2026
4 checks passed
@Cannonb4ll
Cannonb4ll deleted the fix/publish-filament-assets-on-install branch November 25, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uploading image not working

1 participant