deepl-java icon indicating copy to clipboard operation
deepl-java copied to clipboard

1.8.0 doesn't work on servers but does on local machine

Open i5-650 opened this issue 10 months ago • 5 comments

Hello !

I'm using deepl 1.8.0 after i used the 1.7.0 and I face a strange issue:

On my local machine (MacOS), it works fine. The token is a free tier token, therefore it ends with with :fx. However, on the server, the Deepl library throws an error saying:

Illegal character(s) in message header value: DeepL-Auth-Key XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:fx.

If I switch back ti 1.7.0, it works.

i5-650 avatar Jan 22 '25 11:01 i5-650

Hm, I can run the e2e tests with a free key. Can you give some more information about your server please (eg operating system)? Did you update anything else along with the java library? Can you provide the full stacktrace? Can you try making a curl request to our API (eg the usage endpoint) with that auth key?

e.g.

$ curl -X GET 'https://api.deepl.com/v2/usage' \
-H 'Authorization: DeepL-Auth-Key XXXXX:fx' \
-H 'Content-Type: application/json'

JanEbbing avatar Jan 22 '25 16:01 JanEbbing

Hello again,

I figured out the issue: I'm on a k8s an my deepl key is a secret. And, because it needs to be written in base64 for k8s cluster, I did this: echo 'my-key' | base64. I didn't notice that echo added a \n.

Others API that I use do a strip before using the credentials, therefore I didn't suspect it at first. I should have been more careful, but it would be great to add a strip in the deepl library.

i5-650 avatar Jan 22 '25 22:01 i5-650

Ahh, I see. I can create a ticket in the backlog, this does seem useful.

JanEbbing avatar Jan 23 '25 11:01 JanEbbing

@JanEbbing proposed a solution for this issue - https://github.com/DeepLcom/deepl-java/pull/64 Open to feedback, if any

timazhum avatar Feb 14 '25 00:02 timazhum

Looks good to me ! That will prevent people from doing the same mistake as i did

i5-650 avatar Feb 15 '25 13:02 i5-650

Closing this as I believe the issue is addressed in #64

daniel-jones-dev avatar Aug 22 '25 14:08 daniel-jones-dev