vocascan / vocascan-frontend

A highly configurable vocabulary trainer
https://vocascan.com
Apache License 2.0
29 stars 8 forks source link

Large imports give a 413 Payload Too Large error message #142

Open ditmarvisser opened 1 year ago

ditmarvisser commented 1 year ago

Describe the bug When importing a new package the import failes if the number of vocabs is too large. In my testing the number of vocabs seems to be around 1100. The error in the console is "413 Payload Too Large error message". The json file I want to upload is 126 Kb.

I have found that nginx has a default limit of 1Mb on upload files. I have set the value of client_max_body_size in /etc/nginx/conf.d/default.conf to 64M, restarted the container, but that does not seem to make a difference.

To Reproduce Steps to reproduce the behavior:

  1. Go to Packages
  2. Click on Import
  3. Import the following file: https://pastebin.com/ztL2dhmR
  4. See error in the browser console

Expected behavior The package gets imported succesfully.

Additional context Here is an even larger file I was originally trying to import. This is 424 Kb.

noctera commented 1 year ago

Hi @ditmarvisser, thanks for reporting this issue. I have just looked at it on my local machine and could reproduce it. This isn't an error coming from your Nginx configuration. This is an error comming from our Expressjs configuration. We just haven't noticed it, as no one of us tried to upload a file that large. As it seems Expressjs is limiting the size of the upload, the body-parser can parse. According to the internet, this can be fixed with some lines of code. We will try to fix it as far as we can.

PS: Thanks for the other feature request, you have sent us. We really need an option to add multiple packages together :)

Greetings, Noctera

noctera commented 1 year ago

@ditmarvisser This issue is fixed now. But the final release will take some time. However if you already want to use it, you can switch to the experimental branch, or use the experimental docker image build.

Information about how to set the limit (default 1mb), can be found in this pull request vocascan/vocascan-server#96

seyar commented 1 year ago

Also I could not import file from @ditmarvisser from paste bin. There are wrong format. Correct format I found at https://github.com/vocascan/vocascan-server/pull/54