workerd: 🐛 BUG: Error: Origin SSL Handshake Error (525) when making requests to deepl API

Which Cloudflare product(s) does this pertain to?

Workers/Other

What version of Wrangler are you using?

3.1.0

What operating system are you using?

Mac

Describe the Bug

It is impossible to query deepl API from workers.

The bug was first mentioned in August 2021 on the forum. It was stated that “this is typically caused by a configuration issue in the origin web server”. I opened a corresponding issue in their repo and they concluded that “the problem lies with cloudflare workers”. Can you take a look at this problem? Other services might be unreachable as well.

Deepl is a very popular product and it is sad that it can be used with workers.

Code to reproduce

const deepLUrl = 'https://api-free.deepl.com/v2/translate'
const text = 'I like my cat'
const to = 'de'
const from = 'en'

const resp = await fetch(deepLUrl, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    Authorization: `DeepL-Auth-Key ${env.DEEPL}`,
  },
  body: `text=${encodeURIComponent(text)}&target_lang=${to.toUpperCase()}&source_lang=${from.toUpperCase()}`,
})
if (!resp.ok) throw new Error(`DeepL error (${resp.status}) ` + resp.statusText) // throws in workers
const response = await resp.json()
response.translations[0].text // works in node

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (4 by maintainers)

Most upvoted comments

Relevant teams have identified the issue, and expect to address towards the end of this year (2023).

Since this issue is not about the open-source Workers Runtime, closing this issue. If you have further questions, please contact Cloudflare support.

We’re very keen on adopting Cloudflare for our organization, but the occurrence of this issue is a significant roadblock. Some of our engineers believe this problem violates our enterprise tech adoption policy, especially since it’s been noted for other APIs as well. We would greatly appreciate any updates on the progress of this issue resolution.

Based on the 525 handshake error, we’ve moved away from DeepL and instead found that the new Cloudflare Workers AI Translation model is good enough for our needs: https://developers.cloudflare.com/workers-ai/models/translation/ It’s not perfect, doesn’t allow “excluded terms” or anything fancy, but it may be a good stop-gap until this issue is fixed.

Hey @tomardern - I encountered exactly the same problem as yours. Cloudflare hosted AI translators is not perfect for me so I migrated to DeepL. But when I call DeepL’s API on Vercel Edge Runtime, I meet the same strange 525 error.

How I solve this is simply to start a proxy service for it. It is easy to start a proxy service on Netlify, just using a netlify.toml like this:

[[redirects]]
  from = "/*"
  to = "https://api-free.deepl.com/:splat"
  status = 200

Then runs in the same directory:

netlify deploy -d . -p

This works well for me.

Sorry to be "that guy - but is there any update here @irvinebroque?

Hey @Omarov3000 and @tomardern — digging into this internally, thanks for flagging.

I just ran into this issue as well, when calling DeepL API from my worker. Can you please reopen this issue?

I’m wondering why this is apparently so hard to fix… Did anyone find a workaround? 😃

And adding another comment as someone who encountered this, was looking to use Cloudflare Workers, and will now be investigating alternatives instead.

👍 Thanks for the update @irvinebroque.

Based on the 525 handshake error, we’ve moved away from DeepL and instead found that the new Cloudflare Workers AI Translation model is good enough for our needs: https://developers.cloudflare.com/workers-ai/models/translation/ It’s not perfect, doesn’t allow “excluded terms” or anything fancy, but it may be a good stop-gap until this issue is fixed.

We also had to move back to AWS at my company because of this issue 🙁. I hope to get some updates on the progress of this issue resolution too.