Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not swallow Media upload errors #629

Open
leandrocp opened this issue Oct 30, 2024 · 0 comments
Open

Do not swallow Media upload errors #629

leandrocp opened this issue Oct 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@leandrocp
Copy link
Contributor

A bug in the upload logic might raise errors such as:

[debug] HANDLE EVENT "validate" in Beacon.LiveAdmin.PageLive
  Component: Beacon.LiveAdmin.MediaLibraryLive.UploadFormComponent
  Parameters: %{"_target" => ["asset"]}
[debug] Replied in 374µs
[info] JOINED lvu:0 in 745µs
  Parameters: %{"token" => "[redacted]"}
[debug] failed to call Beacon.MediaLibrary.upload(%Beacon.MediaLibrary.UploadMetadata{site: :my_site, config: %{processor: &Beacon.MediaLibrary.Processors.Image.process!/1, providers: [Beacon.MediaLibrary.Provider.Repo], validations: []}, allowed_media_accept_types: ["image/jpeg", "image/gif", "image/png", "image/webp", ".pdf"], path: "/tmp/plug-1730-HXLr/live_view_upload-1730156638-779982521169-1", name: "IMG_9166.jpg", media_type: "image/jpeg", size: 253356, output: nil, resource: #Ecto.Changeset<action: nil, changes: %{}, errors: [], data: #Beacon.MediaLibrary.Asset<>, valid?: true, ...>, extra: nil}) for site :my_site on node :nonode@nohost
[error] GenServer #PID<0.1757.0> terminating
** (Beacon.LiveAdmin.ClusterError) failed to call Beacon.MediaLibrary.upload(%Beacon.MediaLibrary.UploadMetadata{site: :my_site, config: %{processor: &Beacon.MediaLibrary.Processors.Image.process!/1, providers: [Beacon.MediaLibrary.Provider.Repo], validations: []}, allowed_media_accept_types: ["image/jpeg", "image/gif", "image/png", "image/webp", ".pdf"], path: "/tmp/plug-1730-HXLr/live_view_upload-1730156638-779982521169-1", name: "IMG_9166.jpg", media_type: "image/jpeg", size: 253356, output: nil, resource: #Ecto.Changeset<action: nil, changes: %{}, errors: [], data: #Beacon.MediaLibrary.Asset<>, valid?: true, ...>, extra: nil}) for site :my_site on node :nonode@nohost

Got:

  no function clause matching in Image.Error.exception/1

But as reported "the net result of this error is that the page reloads without showing success or failure, and the image is not listed. No error is reported to the user interface in the live admin screens" which should not be the behavior, we should be explicit that something out of ordinary happened and give some feedback to users.

@leandrocp leandrocp added the bug Something isn't working label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant