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

DeepL Free Api fails with response Code 400 #622

Closed
alexanderniebuhr opened this issue Jul 14, 2021 · 12 comments
Closed

DeepL Free Api fails with response Code 400 #622

alexanderniebuhr opened this issue Jul 14, 2021 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@alexanderniebuhr
Copy link
Contributor

Describe the bug

Using DeepL free API, fails with Online Translate with response code 400, with following settings

    "i18n-ally.translate.deepl.apiKey": "***:fx",
    "i18n-ally.translate.deepl.enableLog": true,
    "i18n-ally.translate.deepl.useFreeApiEntry": true,

Extension Version

v2.6.13 (since newer version are not working)

Framework/i18n package you are using

svelte-i18n

Extension Log
Go to View -> Output -> i18n Ally, and paste the content below. You should mask any sensitive information

🐛 ERROR: Error: Request failed with status code 400
Error: Request failed with status code 400
    at createError (c:\Users\Alexander\.vscode-insiders\extensions\lokalise.i18n-ally-2.6.13\dist\extension.js:63042:15)
    at settle (c:\Users\Alexander\.vscode-insiders\extensions\lokalise.i18n-ally-2.6.13\dist\extension.js:94238:12)
    at IncomingMessage.handleStreamEnd (c:\Users\Alexander\.vscode-insiders\extensions\lokalise.i18n-ally-2.6.13\dist\extension.js:190885:11)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
@alexanderniebuhr alexanderniebuhr added the bug Something isn't working label Jul 14, 2021
@alexanderniebuhr
Copy link
Contributor Author

alexanderniebuhr commented Jul 14, 2021

tested with 2.6.17 - not working

@alexanderniebuhr
Copy link
Contributor Author

alexanderniebuhr commented Jul 14, 2021

@terales @antfu sorry for tagging you guys
Might have a Setup, issue but I doubt that for now. I would like to debug more, but I don't get the request to the DeepL API logged.
But getting this done is higher in my priority list than my feature request. Just saying, currently this is a blocker, since we have to fall back to the least optimal google translation :/

@antfu
Copy link
Contributor

antfu commented Aug 11, 2021

Hey @OsirisFrik, could you help to take a look at this and see if it's persist on your side? Thanks.

@OsirisFrik
Copy link
Contributor

I checked this and read the documentation, to use a DeepL free api require a free api key, my country is not allowed to contract DeepL, and I don't have any credit card of a allowed country to contract for test, but I can fix it just based in the docs.

@alexanderniebuhr
Copy link
Contributor Author

@OsirisFrik @antfu I am using a free api key generated for my user, and it does throw the error 400.

@antfu
Copy link
Contributor

antfu commented Aug 12, 2021

@alexanderniebuhr I have make the logger print more information in #641. While I can't not reproduce myself, you can try with the latest version and share the error log? Thanks

@alexanderniebuhr
Copy link
Contributor Author

alexanderniebuhr commented Aug 12, 2021

🌎⚠️ Failed to translate "page.login.headline" (de-DE->en-GB)
🐛 ERROR: Error: Request failed with status code 400
Error: Request failed with status code 400
    at createError (/Users/alexanderniebuhr/.vscode-insiders/extensions/lokalise.i18n-ally-2.6.24/dist/extension.js:116796:15)
    at settle (/Users/alexanderniebuhr/.vscode-insiders/extensions/lokalise.i18n-ally-2.6.24/dist/extension.js:117071:12)
    at IncomingMessage.handleStreamEnd (/Users/alexanderniebuhr/.vscode-insiders/extensions/lokalise.i18n-ally-2.6.24/dist/extension.js:116146:11)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

EDIT: can it be caused, because we use language identifiers with two parts, e.g. en-GB?

@alexanderniebuhr
Copy link
Contributor Author

As soon as I change i18n-ally.translate.engines back to google it works.

@antfu
Copy link
Contributor

antfu commented Aug 12, 2021

Not sure, can you try with de -> en?

@alexanderniebuhr
Copy link
Contributor Author

alexanderniebuhr commented Aug 12, 2021

yeah.. de -> en works.. but de-DE -> en-GB does not work.
Can you split these in code, since we do need to use full identifiers in our projects.
Here the docs what is supported source and target languages: https://www.deepl.com/docs-api/translating-text/request/
Actually it should give back a api response, but that api response from deepl is not logged, maybe caused by an error thrown before logging

@antfu
Copy link
Contributor

antfu commented Aug 12, 2021

Ah ok then. We could strip the second code when passing to deepl then. Thanks for investigating!

@alexanderniebuhr
Copy link
Contributor Author

always happy to help :)
This is also helping me in our projects 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

4 participants