525 Error when making API Call over worker

hey there, I get a 525 error when I try to use the DeepL API from my worker. It works just fine locally and the issue only appears once deployed to production. From researching its got something to do with the SSL handshake between CF and the API but I haven't found a solution, anyone know how to solve it? export async function translateHtml(htmlContent, sourceLang, targetLang, env) { try { console.log('Translating HTML content...'); console.log(htmlContent); const authKey = getEnvironmentVariable('DEEPL_API_KEY', env); const response = await fetch('https://api-free.deepl.com/v2/translate', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams({ auth_key: authKey, text: htmlContent, source_lang: sourceLang.toUpperCase(), target_lang: targetLang.toUpperCase(), tag_handling: 'xml', // Ensure HTML/XML tags are preserved }), }); // Check if the response is successful if (!response.ok) { const errorText = await response.text(); console.error(DeepL API error: ${response.status} - ${errorText}); throw new Error(Translation failed with status ${response.status}); } const result = await response.json(); return result.translations[0].text; } catch (error) { console.error('Error during translation:', error.message || error); throw error; } } It's a fairly straightforward fetch call with js over the worker. Any help would be massively appreciated
2 Replies
Super Morris
Super Morris5w ago
thats what we found https://github.com/cloudflare/workerd/issues/776 however no solution yet
GitHub
🐛 BUG: Error: Origin SSL Handshake Error (525) when making requests...
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 dee...
Super Morris
Super Morris5w ago
@Cloudflare (Server Owner) we really need a solution for this problem.
Want results from more Discord servers?
Add your server