'Deno server TLS Alert HandshakeFailure

I just installed deno to try use it. I wanted to use fetch function to post some data like this :

async function post(url: string, data: FormData): Promise<Response> {
  const response = await fetch(url, {
    method: 'POST',
    body: data,
  });
  return response;
}

I get this error when I run my code with deno run --allow-net main.ts:

TLS alert received: Message {
    typ: Alert,
    version: TLSv1_2,
    payload: Alert(
        AlertMessagePayload {
            level: Fatal,
            description: HandshakeFailure,
        },
    ),
}
error: Uncaught (in promise) TypeError: error sending request for url (https://***********): error trying to connect: received fatal alert: HandshakeFailure
    at handleError (deno:core/core.js:186:12)
    at jsonOpParseResult (deno:core/core.js:356:9)
    at asyncHandle (deno:core/core.js:223:40)
    at Array.asyncHandlers.<computed> (deno:core/core.js:238:9)
    at handleAsyncMsgFromRust (deno:core/core.js:207:32)

However, when I use Curl in Command-line to send data instead, it works.

deno --version gives me:

deno 1.8.3 (release, x86_64-apple-darwin)
v8 9.0.257.3
typescript 4.2.2

Why does it work with Curl but not with deno ? How can I fix this problem



Solution 1:[1]

You have probably run into this issue

Basically the TLS library that Deno uses (rustls) is quite strict and does not support weak ciphers. You can check what ciphers the server offers using the Qualsys SSL Test.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 scytale