5

I recently upgraded a project from 1.22.1 to 1.24.3. Subsequently, pub get has failed with either

Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: self signed certificate in certificate chain(ssl_cert.c:345))

or

Handshake error in client (OS Error: error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED)

I've found similar threads about getting this error, but none of the solutions given in those threads seem to have fixed the issue. I ran pub --trace --verbosity all get as requested in those threads, output here

The less verbose output from Webstorm's console is

    Working dir: C:\SGGDev\pearls\client
    C:\DevTools\dart-sdk-1-24-3\bin\pub.bat get
    Resolving dependencies...
    Downloading uuid 0.5.3...
    Downloading convert 2.0.1...
    Downloading charcode 1.1.1...
    Downloading crypto 2.0.2+1...
    Downloading collection 1.14.3...
    Downloading typed_data 1.1.5...
    Downloading xml 2.6.0...
    Downloading petitparser 1.6.1...
    Downloading matcher 0.12.1+2...
    Downloading stack_trace 1.8.0...
    Downloading path 1.4.2...
    Handshake error in client (OS Error: 
        CERTIFICATE_VERIFY_FAILED: self signed certificate in certificate chain(ssl_cert.c:345))
    Process finished with exit code 1

Before I deleted the pub cache in appdata, a suggested solution, the same error was encountered almost immediately, after the first or second package.

Jacob
  • 53
  • 1
  • 5

2 Answers2

8

Are you on Windows and using Kaspersky antivirus? I do not know all the technical details but this antivirus somehow affects the handshake. Disabling it should help.

Another workaround is to set the following environment variables:

PUB_HOSTED_URL=https://pub.flutter-io.cn FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

The problem is also tracked here though I guess it's not a Dart SDK issue: https://github.com/dart-lang/sdk/issues/32131

Alexander Doroshko
  • 1,831
  • 13
  • 10
  • Disabling antivirus at my work system was not an option. So the second option, which is to override env variables solved my issue. – Sanjay May 04 '20 at 18:41
1

For me the error was caused by my antivirus, i had to disable it to make Dart works.

Rémy Menard
  • 64
  • 1
  • 8