tusd icon indicating copy to clipboard operation
tusd copied to clipboard

Reduce internal server errors

Open Acconut opened this issue 2 years ago • 0 comments

tusd currently returns some 500 Internal Server Error responses which are not necessary or should be other status codes:

  • [ ] [tusd] 2022/03/21 08:20:48 event="ResponseOutgoing" status="500" method="PATCH" path="" body="ERR_INTERNAL_SERVER_ERROR: unexpected EOF This occurs when the request body ends unexpectedly. This is no big deal, tusd will just store the received data. This should not be a ERR_INTERNAL_SERVER_ERROR.
  • [ ] [tusd] 2022/03/21 05:58:23 event="ResponseOutgoing" status="500" method="PATCH" path="" body="ERR_INTERNAL_SERVER_ERROR: http: invalid Read on closed Body I am not sure where this is exactly coming from but maybe from the new locking mechanism with upload interruptions. This needs investigation.
  • [ ] [tusd] 2022/03/21 09:07:09 event="ResponseOutgoing" status="500" method="POST" path="" body="ERR_INTERNAL_SERVER_ERROR: s3store: unable to create multipart upload: MetadataTooLarge: Your metadata headers exceed the maximum allowed metadata size S3 has a limit on the metadata size. From https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html:

The PUT request header is limited to 8 KB in size. Within the PUT request header, the user-defined metadata is limited to 2 KB in size. The size of user-defined metadata is measured by taking the sum of the number of bytes in the UTF-8 encoding of each key and value.

tusd should check the metadata size before and return a 400 error if the 2 KB are exceeded.

Acconut avatar Mar 21 '22 10:03 Acconut