This was a really interesting issue and really hard to catch.
We started to encounter this error which was crashing the app when doing a post request to the server:
console.log from .catch() of the fetch call.
{ [TypeError: Network request failed]
line: 25737,
column: 21,
sourceURL: 'http://localhost:8081/index.ios.bundle?platform=ios&dev=true' }
XCode console output:
[error] [tid:com.facebook.react.JavaScript] Network request failed
[error] [tid:com.facebook.react.JavaScript] Can't find variable: self
[fatal] [tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: Network request failed
[fatal][tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: Can't find variable: self
Communications error: <OS_xpc_error: <error: 0x5a00534> { count = 1, contents = "XPCErrorDescription" => <string: 0x5a00734> { length = 22, contents = "Connection interrupted" } } >
One weird thing is that the first request always throws this error but from the second request everything works fine.
After a long day investigating it we discovered that is related to the HTTP/2 feature
It used to work before, but Chrome deprecated the old way it worked on May 15 and it was de-facto disabled since then.
We've reenabled it by upgrading out openresty which is based on NGINX 1.9.15, but apparently react-native can't handle the upgraded version, which sucks ass.
It will be a pain in the ass to reproduce it since you need OpenSSL 1.0.2, that means the most recent Ubuntu - 16.04, because previous versions are stuck on OpenSSL 1.0.1.
We're running Ubuntu 14.04, so I had to compile OpenSSL from source to make it work.
I saw that on release 0.27 of react-native you guys cherry picked this commit ( 6bbaff2 ) which is related somehow but in the description of the issue ( #4021) that motivated the commit the problem was only for Android however we experienced this in both platforms ( iOS and Android ).
This was a really interesting issue and really hard to catch.
We started to encounter this error which was crashing the app when doing a
postrequest to the server:console.log from
.catch()of the fetch call.XCode console output:
One weird thing is that the first request always throws this error but from the second request everything works fine.
After a long day investigating it we discovered that is related to the HTTP/2 feature
It used to work before, but Chrome deprecated the old way it worked on May 15 and it was de-facto disabled since then.
We've reenabled it by upgrading out openresty which is based on NGINX 1.9.15, but apparently react-native can't handle the upgraded version, which sucks ass.
It will be a pain in the ass to reproduce it since you need OpenSSL 1.0.2, that means the most recent Ubuntu - 16.04, because previous versions are stuck on OpenSSL 1.0.1.
We're running Ubuntu 14.04, so I had to compile OpenSSL from source to make it work.
I saw that on release 0.27 of react-native you guys cherry picked this commit ( 6bbaff2 ) which is related somehow but in the description of the issue ( #4021) that motivated the commit the problem was only for Android however we experienced this in both platforms ( iOS and Android ).