ciur / papermerge

Open Source Document Management System for Digital Archives (Scanned Documents)
https://papermerge.com
Apache License 2.0
2.55k stars 267 forks source link

Papermerge-CLI Uploading Error #538

Closed drtechnofreak closed 1 year ago

drtechnofreak commented 1 year ago

papermerge-cli import Uploaded/ Importing Uploaded/23435-9-041.pdf Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 62, in inner return func(*args, kwargs) File "/usr/local/lib/python3.10/dist-packages/backoff/_sync.py", line 105, in retry ret = target(*args, *kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/rest.py", line 150, in upload_document documents_api_instance.upload_file( File "/usr/local/lib/python3.10/dist-packages/papermerge_restapi_client/paths/api_documents_document_id_upload_file_name/put.py", line 257, in upload_file return self._upload_file_oapg( File "/usr/local/lib/python3.10/dist-packages/papermerge_restapi_client/paths/api_documents_document_id_upload_file_name/put.py", line 235, in _upload_file_oapg raise exceptions.ApiException(api_response=api_response) papermerge_restapi_client.exceptions.ApiException: (413) Reason: Request Entity Too Large HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.18.0', 'Date': 'Sat, 18 Mar 2023 21:05:57 GMT', 'Content-Type': 'text/html', 'Content-Length': '183', 'Connection': 'close'}) HTTP response body: b'\r\n413 Request Entity Too Large\r\n\r\n

413 Request Entity Too Large

\r\n
nginx/1.18.0
\r\n\r\n\r\n' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 62, in inner return func(
args,
kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/rest.py", line 326, in perform_import upload_document( File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 72, in inner raise ApiException from e papermerge_restapi_client.exceptions.ApiException: (None) Reason: None The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/bin/papermerge-cli", line 8, in sys.exit(cli()) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 760, in invoke return __callback(args, *kwargs) File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), args, kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/main.py", line 107, in _import perform_import( File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 39, in inner return func(kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 54, in inner return func(**kwargs) File "/usr/local/lib/python3.10/dist-packages/papermerge_cli/utils.py", line 72, in inner raise ApiException from e papermerge_restapi_client.exceptions.ApiException: (None) Reason: None

ptitboogy commented 1 year ago

Hello, I've got the same issue with file as small as 2,2 MB. How are we supposed to bulk import big documents ?

Thanks

ciur commented 1 year ago

My guess is that the issue may be with the configurations in this file:

https://github.com/papermerge/docker/blob/master/papermerge/nginx.conf

(according to this article: https://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/)

I mean, in nginx config should be added a line like:

client_max_body_size 100M;

where "100M" is the max document size you can upload.

ptitboogy commented 1 year ago

Hi Eugen,

I made the change directly in the running docker image and I confirm that it's working as expected. @ciur : Can you please add this parameter with a reasonable value for the next image you will build ?

Many thanks for your support.

drtechnofreak commented 1 year ago

Hi Guys,

I'm struggling to find the nginx config file within the docker..

Can someone give me the container & path I should be looking for?

Cheers

ptitboogy commented 1 year ago

The file to modify within the container is /etc/nginx/nginx.conf You can add this parameter in the "server" section

drtechnofreak commented 1 year ago

Hi, When I try to CD to etc. I get "permission denied: unknown"

I can only get to bin/app I have checked & I am under root with docker exec

ptitboogy commented 1 year ago

image image

drtechnofreak commented 1 year ago

DMS Thankyou so much.. I'll test to see if it works now :)

drtechnofreak commented 1 year ago

Well it fixed the web upload, but the papermerge-cli is still reporting the same error.

I don't want to upload using web as it's a long process with the amount of files I have.

Hopefully fixed in the next pull :0

ptitboogy commented 1 year ago

Oops, I forgot to mention that you should restart the nginx service too ... /etc/init.d/nginx restart Because it is working on my side and as I understood the parpermerge-cli command use the same REST API

ciur commented 1 year ago

I released 2.1.9 which contains above mentioned fix. The max size for uploaded document (max size one document can have) is hardcoded to 100 MB.

I also updated "Import Folders/Document" section in the documentation with instructions about --taget-uuid option.

Please don't forget to close the ticket in case you think the issue was resolved.

ptitboogy commented 1 year ago

Hi,

@ciur : For me it's ok but I'll let @drtechnofreak the opportunity to close his ticket.

drtechnofreak commented 1 year ago

image Lovely stuff chaps..

I'll see how far PaperMerge can go with around 400gb of PDF's :)