[bug] brick after media upload fail #339

Closed
opened 2023-09-02 09:49:06 +00:00 by Crafti · 5 comments

Version

e530c2b

What were you trying to do?

Upload a media attachment

What did you expect to happen?

For it to appear in the media tray

What actually happened?

No attachment was added, this error is being thrown in the console

TypeError: t is undefined
    r file_type.service.js:9
    data attachment.js:57

Trying to send the post, can cause two different errors.

  1. Server returns 422 "Cannot post an empty status without attachments" because the post was empty
  2. Server returns 400 "Internal server error" because the FE tried to submit media_ids[] set to undefined

In either cases the FE displays following message: Error: t.text is undefined

Refreshing the FE causes it to refuse to render the page with the TypeError mentioned before, thus being bricked.

If this was done while replying to someone, it becomes impossible to reopen or toggle the replying form again, with following error:

TypeError: e is null
    [...]
    tn status.js:90
    toggleReplying status.js:482
    [...]
    8948/Ot</e[0]< reply_button.vue:8
    [...]

Severity

I cannot use it as easily as I'd like

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Version e530c2b ### What were you trying to do? Upload a media attachment ### What did you expect to happen? For it to appear in the media tray ### What actually happened? No attachment was added, this error is being thrown in the console ``` TypeError: t is undefined r file_type.service.js:9 data attachment.js:57 ``` Trying to send the post, can cause two different errors. 1. Server returns 422 "Cannot post an empty status without attachments" because the post was empty 2. Server returns 400 "Internal server error" because the FE tried to submit `media_ids[]` set to `undefined` In either cases the FE displays following message: `Error: t.text is undefined` Refreshing the FE causes it to refuse to render the page with the TypeError mentioned before, thus being bricked. If this was done while replying to someone, it becomes impossible to reopen or toggle the replying form again, with following error: ``` TypeError: e is null [...] tn status.js:90 toggleReplying status.js:482 [...] 8948/Ot</e[0]< reply_button.vue:8 [...] ``` ### Severity I cannot use it as easily as I'd like ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
Contributor

Hit that same error just now.

The only way to recover is deleting local storage from the Inspect tool.

For the record, this is in Firefox. I was able to upload the same attachment in Google Chrome.

Hit that same error just now. The only way to recover is deleting local storage from the Inspect tool. For the record, this is in Firefox. I was able to upload the same attachment in Google Chrome.
Contributor

was the attachment a bmp image? if not, can you upload the attachment somewhere and link it? this seems similar to #396

was the attachment a bmp image? if not, can you upload the attachment somewhere and link it? this seems similar to #396
Contributor

Sorry, it's been a while. I don't think I've had that issue happen since, and I don't have whatever I was trying to upload at the time on hand anymore.

Sorry, it's been a while. I don't think I've had that issue happen since, and I don't have whatever I was trying to upload at the time on hand anymore.
Owner

This generally happened afairc when the upload failed with an error response. We fixed the issues in the backend (if any) leading to such responses, so e.g. BMP files work now.

However we left this open, becuase regardless of what the backend returns, the frontend shouldn’t save invalid data to its internal state in such a way it completely bricks itself. Instead it should display an erorr popup with any information and not modify the attachment state at all.
You can probably reproduce the bricking issue with a local dev server by stubbing out the upload endpoint to always return a HTTP 500 error.

This generally happened afairc when the upload failed with an error response. We fixed the issues in the backend (if any) leading to such responses, so e.g. BMP files work now. However we left this open, becuase regardless of what the backend returns, the frontend shouldn’t save invalid data to its internal state in such a way it completely bricks itself. Instead it should display an erorr popup with any information and not modify the attachment state at all. You can probably reproduce the bricking issue with a local dev server by stubbing out the upload endpoint to always return a HTTP 500 error.
Contributor

[…], the frontend shouldn’t save invalid data […] You can probably reproduce the bricking issue with a local dev server […]

oh, that's a very good point! I'll see if I can do anything tomorrow or so

> […], the frontend shouldn’t save invalid data […] You can probably reproduce the bricking issue with a local dev server […] oh, that's a very good point! I'll see if I can do anything tomorrow or so
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AkkomaGang/akkoma-fe#339
No description provided.