amplitude / experiment-ios-client

MIT License
3 stars 12 forks source link

Bad URL on ExperimentClient.start/fetch #57

Open nebsta opened 3 months ago

nebsta commented 3 months ago

We've noticed that we seem to be getting a fair few errors whenever we call the ExperimentClient.start / ExperimentClient.fetch methods.

We use Sentry for our error reporting, and we have set it up so that we send most errors through to Sentry whenever we get an error from the start call. You can see the exact details/numbers here via our Sentry reporting:

Note that the error name contains the error code/domain

Screenshot 2024-08-13 at 11 14 36

Based on the error code we're getting in the callbacks, it seems like the error is due to a bad URL (see NSURLErrorDomain codes), though based on the breadcrumbs in Sentry, the url seems to be fine.

Screenshot 2024-08-13 at 11 11 39

bgiori commented 2 months ago

Hi @nebsta sorry for the delay, and thanks for submitting this issue.

Not sure why this URL would return this error code...

  1. What is the frequency of these errors? Is it very common or very uncommon?
  2. Do you have any way to check where these users are located geographically?
  3. Do you have any way to reproduce locally?
nebsta commented 2 months ago

@bgiori

  1. What is the frequency of these errors? Is it very common or very uncommon?

In total we've seen about 860 instances of this happening across 311 users. We're seeing about 20 instances of this exception occurring per day

  1. Do you have any way to check where these users are located geographically?

I did a check and could see that the locale isn't consistent. Just doing a general check I saw users from Australia, Britain and Germany

  1. Do you have any way to reproduce locally?

Unfortunately not

bgiori commented 2 months ago

Based on the screenshots provided, the URLs look valid. Is it possible the users just have poor network connectivity, and this error is a red herring? Do you get other errors for connection timouts/DNS resolution errors?

nebsta commented 2 months ago

@bgiori we do have some, but most of those we filter out due to them not being possible for us to resolve.

bgiori commented 1 month ago

Sorry for the delay. Unfortunately I am unable to reproduce this error. Is it possible to get more info from the error passed in the completion?

For example, when I turn of my network connectivity and run a test on my mac, I get the following error:

Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x60000336e9a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=50, _NSURLErrorNWResolutionReportKey=Resolved 0 endpoints in 1ms using unknown from cache, _NSURLErrorNWPathKey=unsatisfied (No network route)}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <B64B86B1-5327-484B-875C-713F6620215C>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <B64B86B1-5327-484B-875C-713F6620215C>.<1>"
), NSLocalizedDescription=The Internet connection appears to be offline., NSErrorFailingURLStringKey=https://api.lab.amplitude.com/sdk/v2/vardata?v=0, NSErrorFailingURLKey=https://api.lab.amplitude.com/sdk/v2/vardata?v=0, _kCFStreamErrorDomainKey=1}

The error returned in your stack trace seems terse: -1000:NSURLErrorDomain: Code: 9301