question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let's encrypt CA websocket fails on Android api < 20

See original GitHub issue

Is this a bug report?

Yes

Environment

Environment: OS: macOS Sierra 10.12.6 Node: 9.3.0 Yarn: 1.3.2 npm: 5.6.0 Watchman: 4.7.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 2.1 AI-143.2915827

Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: 0.49.3 => 0.49.3 Target Platform: iOS (10.3)

Steps to Reproduce

I have a node server which uses Let’s Encrypt CA. I try to connect to it using websockets. On iOS and newer Android versions (API > 20) it connects successfully. When running on older Android versions (both on simulator and actual devices) it never connects. I have tried to connect using older Android version to a server that’s not using Let’s encrypt CA, and it also connects successfully.

The error I get when using this:

    ws.onerror = (e) => {
      // an error occurred
      console.log(e.message);
    };

is Connection closed by peer

and this:

    ws.onclose = (e) => {
      // connection closed
      console.log(e.code, e.reason);
    };

logs undefined, undefined

Expected Behavior

Connect to the server

Actual Behavior

Fails

Reproducible Demo

    var ws = new WebSocket('wss://example.now.sh');

    ws.onerror = (e) => {
      // an error occurred
      console.log(e.message);
    };

    ws.onclose = (e) => {
      // connection closed
      console.log(e.code, e.reason);
    };

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
react-native-botcommented, Feb 24, 2018

Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?

I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.

How to ContributeWhat to Expect from Maintainers

0reactions
perrosnkcommented, Nov 26, 2018

@shamilsun put this into your MainApplication.java file:

  private void upgradeSecurityProvider() {
    ProviderInstaller.installIfNeededAsync(this, new ProviderInstallListener() {
        public void onProviderInstalled() {
          // You can do something here
        }

        public void onProviderInstallFailed(int errorCode, Intent recoveryIntent) {
            GooglePlayServicesUtil.showErrorNotification(errorCode, MainApplication.this);
        }
    });
  }

I hope that helps

EDIT: Add this too:

  public void onCreate() {
    super.onCreate();
    upgradeSecurityProvider();
  }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Let's encrypt cerificate to work with android api < 20
I have tried to connect using older Android version to a server that's not using Let's encrypt CA (but IS using ssl from...
Read more >
Users of older Android and Windows 7 not able to access ...
I've launched PowerShell as the SYSTEM user and attempt to connect to both the Prod API endpoint and the main Let's Encrypt website....
Read more >
Secure WebSocket fails CBLite C# .NET - Couchbase Lite
The first thing that comes to mind is that your Android device doesn't have enough information to reconstruct the chain of trust (i.e....
Read more >
993907 - WebSocket cancels connections requiring Client ...
It is caused because we have no API which says "select a client certificate, but only if it can be done without showing...
Read more >
How to Fix the NET::ERR_CERT_AUTHORITY_INVALID Error
SSL CERTIFICATE ERROR. In every case, Chrome pinpoints the source of the error within the certificate. The browser lets you proceed to the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found