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

413 Request Entity Too Large #40

Closed
grandeljay opened this issue Jan 16, 2024 · 2 comments
Closed

413 Request Entity Too Large #40

grandeljay opened this issue Jan 16, 2024 · 2 comments

Comments

@grandeljay
Copy link

grandeljay commented Jan 16, 2024

I am trying to translate 1009 lines of text (312 KiB) in a single POST request via a WordPress plugin I created and can't due to a generic internal server error (HTTP 500). After inspecting the logs, I found this client error:

PHP Fatal error:  Uncaught DeepL\DeepLException: Unexpected status code: 413 , <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>
, content: <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>

I've done some brief research, to find that the maximum possible size of a POST request is limited by the server, as well as the client by doing something like: min(serverMaxSize, clientMaxSize). Since it's a HTTP 4xx error, I presume the fault lies within the library/client here?

Here are some of my server settings (php.ini), which look fine to me:

Key Value Description
max_input_vars 1000 PHP max input variables
max_execution_time 30 PHP time limit
memory_limit 512M PHP memory limit
max_input_time 60 Max input time
upload_max_filesize 50M Upload max filesize
post_max_size 50M PHP post max size

Any ideas are greatly appreciated! Thanks for making this open source!

@JanEbbing
Copy link
Member

Yes, you are running into a limitation of the API - requests must be below 128K in size (to stay within that limit, we recommend to limit texts to translate to 105-110KB). We don't handle larger texts in the client libraries yet (e.g. by splitting a large request into multiple smaller ones), since we want to ensure maximum translation quality and it's not easily possible to split a text while preserving this quality.
Do you see a way to adhere to that limit, even for a larger WP post? (Also please note, we do not provide the WP Plugin but the Client library it uses.)

@grandeljay
Copy link
Author

API - requests must be below 128K in size

Alright, good to know!

We don't handle larger texts in the client libraries yet (e.g. by splitting a large request into multiple smaller ones), since we want to ensure maximum translation quality and it's not easily possible to split a text while preserving this quality.

That's no problem for me. I was just trying to find a way to determine what the POST max size is, so I can enforce it. Now I know, thanks!

Do you see a way to adhere to that limit, even for a larger WP post?

My plugin is actually a simple UI for translating structured content (html, xml), since I don't believe DeepL offers a GUI for that anywhere. I'll just simply limit the input to ~110 KiB

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

2 participants