Signalen / frontend

Frontend for Signalen, an application that helps cities manage and prioritize nuisance reports.
https://signalen.org
Mozilla Public License 2.0
10 stars 4 forks source link

Check size attachment after uploading, not after sending signal #125

Closed someren closed 3 years ago

someren commented 3 years ago

Describe the bug There is a maximum size an attachment can have. I do not know the exact maximum but 2.5MB is too large. After selecting the attachment I continue answering the follow up questions, phone number, e-mailadres etc. However, only after clicking "Send" I get a error message: Het uploaden van de foto is niet gelukt. The ticket is added to Signalen but without attachment. I would like to have received this information sooner, immediatly after selecting/uploading the attachment.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Melden'
  2. Click on 'Add photo'
  3. Select a photo of at least 2.5 MB. No error or warning appears.
  4. Go to the following steps
  5. Press "Send" and now receive a message that the attachment could not be uploaded.

Expected behavior Immediatly after selecting/uploading an attachment a message or warning should appear that the attachment is too large to be uploaded. Important information is lost and cannot be added by the melder.

Screenshots Uploaden foto niet gelukt

Desktop (please complete the following information):

someren commented 3 years ago

Alternative: Increase the maximum upload size from 2/3 MB to 10-15MB. Pictures that are made on a smartphone are simply larger than a few MB...

MauritsR commented 3 years ago

The front-end contains a hardcoded minimum and maximum file size for the attachment. Minimum: 30 KB, Maximum: 8 MB.

When a users selects an image larger or smaller than these bounds, the file is not accepted and a message is shown immediately (screenshot Amsterdam acceptance environment):

Example 1 Example 2

Within the Amsterdam acceptance environment I can succesfully upload a 3,8 MB file.

@tcoenen @bartjkdp Is the min/max size of a file configurable in the Backend? Is this perhaps configured with a different value in the Den Bosch config?

tcoenen commented 3 years ago

API_MAX_UPLOAD_SIZE is a backend setting which can be set through an environment variable.

joostvkempen commented 3 years ago

tested with production environment of 's-Hertogenbosch on Android phone with Chrome mobile: photo can be added in environment directly from the camera. Error occurs when sending the complete signal.

seems the front- and backend limitations are not in sync. This should be part of documentation for deployment?

bartjkdp commented 3 years ago

@joostvkempen thanks for testing!

The problem was not in the Signalen frontend or backend, but in the loadbalancer in front. It limited requests to 2MB.

I created a fix in the Helm Charts and deployed this to the 's-Hertogenbosch environments.