3

I've deployed a node.js service (REST API) in GCP Run and I'm having issues with the TLS handshake in Flutter.

Unhandled Exception: HandshakeException: Handshake error in client (OS Error: WRONG_VERSION_NUMBER(tls_record.cc:242))

The code that I'm trying to use is:

static Future<http.Response> get(String url, {Map<String, String>? headers}) async {
    final _headers = await _addAuthHeader(headers); //appends the authorization header (not used right now)
    final out = await http.get(Uri.parse(url), headers: _headers); //this throws the exception
    return out;
}

In GCP Run I've haven't set anything about the security other than the allow unauthenticated calls so I should be using the managed TLS service.


I've tested in the following conditions:

  • curl https://<url> works ✅
  • curl --tls-max 1.2 https://<url> works ✅
  • curl --tls-max 1.1 https://<url> doesn't work ❌ (maybe Flutter doesn't support TLS 1.2?)
  • In dart (HTTPS call) using dio package doesn't work ❌
  • In dart (HTTPS call) using http package doesn't work ❌
  • In dart (HTTP call) works ✅
  • In chrome works ✅

I've tried the solutions proposed in these other posts:


System information:

  • Flutter version: 3.3.8
  • Dart version: 2.18.4
  • Flutter doctor: everything fine

0 Answers0