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

Papermerge-CLI Uploading Error #538

Closed
drtechnofreak opened this issue Mar 20, 2023 · 13 comments
Closed

Papermerge-CLI Uploading Error #538

drtechnofreak opened this issue Mar 20, 2023 · 13 comments

Comments

@drtechnofreak
Copy link

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\n<title>413 Request Entity Too Large</title>\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
Copy link

ptitboogy commented Mar 30, 2023

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
Copy link
Owner

ciur commented Mar 31, 2023

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
Copy link

ptitboogy commented Mar 31, 2023

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
Copy link
Author

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
Copy link

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

@drtechnofreak
Copy link
Author

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
Copy link

image
image

@drtechnofreak
Copy link
Author

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

@drtechnofreak
Copy link
Author

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
Copy link

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 added a commit to papermerge/docker that referenced this issue Apr 1, 2023
ciur added a commit to papermerge/docker that referenced this issue Apr 1, 2023
@ciur
Copy link
Owner

ciur commented Apr 1, 2023

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
Copy link

Hi,

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

@drtechnofreak
Copy link
Author

image
Lovely stuff chaps..

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants