-
Notifications
You must be signed in to change notification settings - Fork 22
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
400 Bad request errors with Japanese texts #55
Comments
Hi @ttreder-explorance, can you please share the code you used, or the array indices in each batch? I was not able to reproduce the issue so far, using the first 60 or 100 array items. |
|
Hi, thanks for the code. I was not able to reproduce the problem. I'll ask some other engineers if they have an idea. Does the issue happen consistently for these inputs? I'm wondering if it is the input content triggering the issue. If you lower the batch size limit (to say 100KiB), is the problem resolved? That wouldn't be ideal, but might be useful to understand the problem. |
The issue is happening consistently with the same file. It's also not happening consistently with other languages files (even arabic). |
I might be experiencing something similar. i tried translating a Markdown text from Spanish -> English. We're in production and wanted to ship this feature but this is limiting at the moment and I do not know how to resolve. export const translator = new deepl.Translator(env.DEEPL_API_KEY);
const result = await translator.translateText(
text,
"es",
"en",
);
return result; When I used this as English -> Other language, things worked fine even with Markdown. HOwever, translating from other language back to English was throwing an error: I tried translating same text on the web using this https://www.deepl.com/en/translator and it worked fine |
@daniel-jones-dev I found the problem. I used |
Hi @daniel-jones-dev, I just got the same 400 bad request with some French texts this time. It not happening all the time anymore. It looks very random. Sometimes it's working, sometime not. Not sure what to think about it anymore. |
I'm using |
Also seeing an issue with receiving a 400. In my case, it was related to the amount of requests that were being issued in parallel from the client. Sending the same requests sequentially resulted in no error. I think there may be some issue either in the client or on DeepL's side related to load in some way? Haven't dug much deeper to see where the issue lies. |
@daniel-jones-dev by digging deeper into this I managed to solve this problem that I wish was documented properly. So for future devs that stumble onto the same problem, here it is: We sometimes have very large files of texts to translate and have to batch calls to the DeepL API. For security reasons, the api has a throttling algorithm implemented, but the configuration for it is undocumented. From our early tests, we realized that having a leaking bucket of 10 requests + a refresh of 1 per second afterward was the best to maximize the batches speed while not getting any 423 Too Many Requests error. What a surprise when we discovered that you can also get 400 undocumented errors when you send large payloads (size will vary depending on the language of your texts, probably due to encoding) at a fast rate. To solve that issue, we removed changed our leaking bucket algorithm to only allow 1 request every second. With this, we can send size maxed payload requests without getting that 400 Bad Request error (that should really be a 423). I think those details are fairly important for developer that wants to use your API and I would suggest adding them to your Usage and Limits page. |
Hi @ttreder-explorance, thanks for the follow up and the detailed report. |
Describe the bug
We are getting 400 errors when calling POST /v2/translate with the DeepL-node library translateText() method when using Japanese comments from the following file.
To Reproduce
Steps to reproduce the behavior:
DeepL API response POST /v2/translate 400 Response details:, content =
Expected behavior
The /v2/translate endpoint should have a consistent behaviour when translating Japanese texts.
Environment:
Additional context
We did try the translation API with a lot of different languages, so far Japanese seems to be the only one causing this issue.
Also worth noting that when we use the /document DeepL API translate the document correctly.
The text was updated successfully, but these errors were encountered: