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

Provide better error message when submission fails because of 413 (payload too large) #4476

Open
lognaturel opened this issue Mar 17, 2021 · 1 comment
Labels
enhancement help wanted Issues that are well-specified and don't require too much context.

Comments

@lognaturel
Copy link
Member

lognaturel commented Mar 17, 2021

Problem description

Web servers are generally configured to only accept files under a certain limit. For Central, that limit was 20MB in versions prior to 1.1 and for v1.1+ the default nginx config sets the limit to 100MB. Currently the error message displayed on submission when an attachment larger than the threshold is submitted is raw from the server which is ugly and not very helpful:
device-2021-03-17-101709

Steps to reproduce the problem

Submit an attachment >100MB to a Central server such as https://demo.getodk.org. ~30s of uncompressed video generally gets above that threshold.

Expected behavior

We know for sure that a 413 means the payload was too large so we can provide a helpful, localized message. The ideal would be something like "This submission includes an attachment of type %1$s which is too big (%2$sMB) to be accepted by the server at %3$s. Please resize the attachment or contact the person who asked you to collect data."

  • %1$s the extension of the file that failed
  • %2$s the size of the file in MB
  • %3$s the server DOMAIN (not the full submission URL)

Note that it doesn't include the filename because the filename is a timestamp so will not be recognizable to the user. Hopefully the file type gives enough information.

Other information

See FormSourceExceptionMapper and how the exception types it knows are generated for ideas on how to structure this addition.

We recently addressed this in Central frontend - getodk/central#178.

@lognaturel lognaturel added help wanted Issues that are well-specified and don't require too much context. enhancement labels Mar 17, 2021
@ChrisHilborne
Copy link

Hi,

If this is still available I'd like to have a look at it.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Issues that are well-specified and don't require too much context.
Projects
None yet
Development

No branches or pull requests

2 participants