OpenLightingProject / open-fixture-library

A library and website for lighting technology's DMX fixture definition files.
https://open-fixture-library.org/
MIT License
189 stars 64 forks source link

Import Fixture Upload Error #3837

Closed DaAwesomeP closed 4 months ago

DaAwesomeP commented 6 months ago

As a followup to #3832, I got the following when attempting to submit.

This file was downloaded from https://gdtf-share.com/userPage.php?name=Robe%20Lighting%20s.r.o.&page=Revisions&fixtureId=472

Unfortunately, there was an error while uploading. Please copy the following data and[ manually submit them to GitHub ](https://github.com/OpenLightingProject/open-fixture-library/issues/new).

{
  "plugin": "gdtf",
  "fileName": "Robe_Lighting@Robin_Esprite@2024-02-15__Animation_wheels_channel_sets_revision.gdtf",
  "fileContentBase64": "long file...",
  "author": "Perry Naseck"
}

Request failed with status code 413

There seems to be a max char limit on GitHub:

image

FloEdelmann commented 6 months ago

Request failed with status code 413

HTTP Status Code 413 means "Content Too Large": https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413

So something is not quite right yet... @luc122c Dou you know what could be the culprit?

DaAwesomeP commented 6 months ago

It seems that maybe GitHub does not like such large messages in issues since I got the equivalent error when pasting into the UI.

FloEdelmann commented 6 months ago

Yes, GitHub has a character limit (65536 according to your screenshot), and the error message that includes the uploaded file as an base64-encoded string is larger than that.

But the error message "Request failed with status code 413" is not from GitHub but from the fixture upload, so it's a server error that we can fix.

luc122c commented 6 months ago

So something is not quite right yet... @luc122c Dou you know what could be the culprit?

My initial thought was that 50mb was being interpreted as MegaBits (rather than MegaBytes). However, express.json uses uses the bytes library, which only seems to interpret Bytes, not Bits.

@FloEdelmann Is the site going through Cloudflare or any other service that could be imposing a limit?

FloEdelmann commented 6 months ago

Nope, no CDN or (external) reverse proxy. Maybe the Nginx reverse proxy and Express interpret the file size differently?

DaAwesomeP commented 6 months ago

@FloEdelmann what is client_max_body_size set to in Nginx for that location block? Default is 1m.

Maybe try setting it to 51M (1MB more than 50 to allow for rest of HTTP request with a theoretical 50MB file)?

http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

FloEdelmann commented 6 months ago

Seems like the default applies then: https://github.com/OpenLightingProject/open-fixture-library/blob/master/server/nginx-site-available

DaAwesomeP commented 5 months ago

I could open a pull to modify nginx-site-available, but it is probably easier for the server admin to just try inserting client_max_body_size 51M; in production.

FloEdelmann commented 5 months ago

I'd appreciate a PR, then I can apply it on production.

FloEdelmann commented 4 months ago

see https://github.com/OpenLightingProject/open-fixture-library/pull/3860#issuecomment-2033165404