Learn business growth with Google Analytics 4 Forums Google Analytics 4 Troubleshooting SSL connection issue with Firebase

  • Troubleshooting SSL connection issue with Firebase

    Posted by Mia on 16 October 2022 at 2:06 am

    Hey buddies! So I’m stuck in this serious jam and can’t seem to find a way out, the internet’s been no help either.

    Long story short, I keep running into some issues whenever I attempt to use Firebase Events. More accurately,

    I get hit with a ‘Network upload failed. Will retry later. SSLHandshakeException: CertPathValidatorException: Trust anchors for certification path not found’ message.

    In case you’re wondering, this project is loaded with security measures. To even construct this app, you have to insert some certs in your keytool and – lo and behold – a super aggressive VPN.

    The hitch is, we need to test some events using GA4/Firebase and guess what? I can’t seem to connect my device to the Firebase DebugView nor log even a single successful event. We could be waiting for hours, or even godforsaken days… our event still never shows up.

    We’ve also tried a few commands, like this one:

    adb shell setprop debug.firebase.analytics.app "your.app.package.name"
    

    And several others, like those cheeky log.tag.FA commands to get a glimpse of something in the logcat.

    I’ve also attempted using the networkSecurityConfig, setting both user and system certificates as trust anchors. But to no avail, unfortunately.

    So yes, I’ve hit a wall here and I’m hoping someone out there has the magic spell to my issue.

    Oh, and just so you know, I’ve been running this application on a simulator.

    Really hope to hear back soon, and thanks in advance!

    Jayden replied 11 months, 2 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Addison

    Member
    21 January 2023 at 11:37 am

    Your problem seems to be related to an SSL Certificate not being recognized by Firebase/Google Analytics. One of the primary causes of SSLHandshakeException is that the SSL certificate presented by the server is not trusted.

    If you are using a self-signed certificate or a certificate issued by an internal certificate authority (CA), make sure it’s imported and properly set up in your Android key store. If that doesn’t work, consider using an SSL certificate from a well-known CA to ensure Firebase recognises and trusts the server’s certificate during the SSL handshake.

    Additionally, the problem may also be due to restrictions caused by VPN. Google uses your device’s IP to deliver the analytics data. If you are using a VPN, it can interfere with, or block, traffic between your app and Firebase.

    Lastly, it may be beneficial to try running your application on a real device instead of a simulator. Certain network-related operations can return different results on real devices and emulators.

    Without further details and specifics about your project’s setup and settings, it’s difficult to provide a more precise solution. However, I hope this general advice helps you understand possible steps to resolve the issue.

  • Jayden

    Member
    28 April 2023 at 10:33 am

    Your Firebase Events issue appears to be a result of the system failing to establish a trusted connection, which is likely arising from problems with the SSL certificate’s validation path. As you mentioned, you’ve tried using network security configuration, and you’re testing the application in a secured environment. This suggests that the SSL certificate might not be correctly imported into your Android application, or its alias and password could be improperly set. Also, one common thing to check is if the date/time settings on your Android device are correct, as this could affect SSL handshake too. Given that you’re running the application on a simulator, you might want to try testing it on an actual device to see if the problem persists. Make sure any firewalls or VPN aren’t blocking the Firebase’s IP addresses that could be leading to the SSLHandshake errors.

Log in to reply.