First, turn on remote debugging. Then:
import RNFS, {DocumentDirectoryPath} from 'react-native-fs';
//...
RNFS.stat(DocumentDirectoryPath+'/notHere.jpg').catch((err) => {
console.warn(err);
})
From the stack trace, it appears that the error is coming from react native attempting to serialize the native NSError provided by NSFileManager and send it over the websocket to the remote debugger.
Turn off remote debugging.
How'd you find the stack trace? All I see in the stack are react files not the call that triggered this.
sorry, I meant the objective C stack trace. I added a breakpoint in the .m file shown as the last line in the red box and traced it back. Don't know enough yet about react internals to know what it is expecting instead of an NSError in the callback. Probably some sort of wrapped error.
Hmm I can't even get that much. That shows up in Xcode?
Indeed. I found the file using cmd+shift+o in xcode and added a breakpoint at line 82 like this:

you can then use the xcode debugging utility to step through the threads to find the call that dispatched the unwrapped NSError
This seems to be an underlying error (no pun intended) in react native. I've opened this issue there https://github.com/facebook/react-native/issues/10506
I'm hitting a similar error:
RCTJSONStringify() encountered the following error: Invalid type in JSON write (NSURL)
With NSURL in brackets instead.
I haven't been hitting this error until I upgraded RN from 0.37 to 0.41.
Traced this issue to triggering on every app launch, only with use of https://github.com/CRAlpha/react-native-wkwebview
@fungilation I am getting the same error at RN 0.42. Any updates on this issue ? How did you resolve it ?
@fungilation If the JS you pass to evaluateJavascript on wkwebview causes an error within the webview, it will cause this issue to appear.
Most helpful comment
@fungilation I am getting the same error at RN 0.42. Any updates on this issue ? How did you resolve it ?