Investigate NSURLError `cannot parse error` for API calls

We have been seeing a NSURLError cannot parse error with error code -1017 for 0.01% of all the requests fired from our native app. We double checked the request headers and cookies but found no difference from the API calls that succeeded for the same path. For most of these requests, we found (through our analytics tools) that 99% of the times, there was no response received from the server(response object is nil); trying to understand why would a no response cause a cannot parse error. We do not get much information from error received as to what really went wrong, did the request even reach the server or was killed or modified by the OS? Any help or further detail will be very helpful.

Error in detail: Foundation.URLError(_nsError: Error Domain=NSURLErrorDomain Code=-1017 "cannot parse response" UserInfo={NSUnderlyingError=0x280eddc50 {Error Domain=kCFErrorDomainCFNetwork Code=-1017 "(null)" UserInfo={_kCFStreamErrorCodeKey=-1, _kCFStreamErrorDomainKey=4}}, NSErrorFailingURLStringKey=https://mydomain.com/path, NSErrorFailingURLKey=https://mydomain.com/path, _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-1, NSLocalizedDescription=cannot parse response})

I am also facing this issue

+1 even I'm also facing a similar issue.

Hmmm, this is reminiscent of this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

+1 also encountering this error on a seemingly simple GET request. Interestingly, when I setup a proxy (Proxyman), requests from the same device succeed, then start failing again when I turn proxying off. Suggests to me it has something to do with the network connection to our specific server (i.e. the proxy tool is masking an underlying issue).

Has anyone on the thread here has success in resolving/avoiding this error?

Reading the other thread that @eskimo mentions, I notice mention of the problem starting when "servers migrated to Http2". We also similarly moved to Http2 when we introduced a caching layer in front our service. Requests direct to the underlying service don't exhibit this issue, but I'm hoping we can determine a more specific cause.

facing the same issue here. I randomly get this error after starting a request. @captainkirkwood did you find a workaround?

same problem here, no solution yet...

Investigate NSURLError `cannot parse error` for API calls
 
 
Q