Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests capturing messages and exceptions on iOS are not being sent to the sentry project #17

Open
buenaflor opened this issue Jul 19, 2022 · 3 comments

Comments

@buenaflor
Copy link
Contributor

buenaflor commented Jul 19, 2022

Problem Statement

Capturing messages and exceptions on iOS tests doesn't send them to the sentry project.

@buenaflor buenaflor added Type: Bug Something isn't working Platform: iOS labels Jul 19, 2022
@buenaflor buenaflor changed the title Test: capturing messages and exceptions on iOS are not being sent to the sentry project Tests capturing messages and exceptions on iOS are not being sent to the sentry project Jul 19, 2022
@marandaneto
Copy link
Contributor

@buenaflor does the iOS SDK has a flush method that awaits the async dispatch to be finished?

@marandaneto
Copy link
Contributor

@buenaflor can you link the SSL issue? that is strange, we didn't run into this issue anywhere else.

@buenaflor
Copy link
Contributor Author

buenaflor commented Apr 24, 2023

@marandaneto

I have a fix ready for the async part but the largest problem is the ssl error.
Here is a snippet of the error:

Request failed: Error Domain=NSURLErrorDomain 
Code=-1200 
"An SSL error has occurred and a secure connection to the server cannot be made." 
UserInfo={
    NSErrorFailingURLStringKey=https://o447951.ingest.sentry.io/api/5903800/envelope/, 
    NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, 
    _kCFStreamErrorDomainKey=3, 
    _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <C6DB900D-8382-4009-8606-7860E11552FA>.<2>, 
    _NSURLErrorRelatedURLSessionTaskErrorKey=(
        "LocalDataTask <C6DB900D-8382-4009-8606-7860E11552FA>.<2>"
    ), 
    NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., 
    NSErrorFailingURLKey=https://o447951.ingest.sentry.io/api/5903800/envelope/, 
    NSUnderlyingError=0x6000020d50e0 {
        Error Domain=kCFErrorDomainCFNetwork 
        Code=-1200 
        "(null)" 
        UserInfo={
            _kCFStreamPropertySSLClientCertificateState=0, 
            _kCFNetworkCFStreamSSLErrorOriginalValue=-9836, 
            _kCFStreamErrorDomainKey=3, 
            _kCFStreamErrorCodeKey=-9836, 
            _NSURLErrorNWPathKey=satisfied (Path is satisfied), 
            interface: en0[802.11]
        }
    }, 
    _kCFStreamErrorCodeKey=-9836
}

What I've tried so far to fix it:

  • Set NSAllowsArbitraryLoads to true in NSAppTransportSecurity in info.plist
  • Create a custom NSUrlSessionDelegate and pass it to the Sentry SDK

To further test it I tried to send a request to httpbin.org/status/404 and it also failed due to a very similar ssl error at first but I was able to fix that with the two options above but the error when sending an event to sentry was still there.

It's strange but only happens in the Kotlin Multiplatform test suite. I'll try to see if that happens in tests directly in the iOS project.

@buenaflor buenaflor added Platform: KMP and removed Type: Bug Something isn't working Platform: iOS labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants