Passthrough is resulting in error in native code for react native
See original GitHub issueHi,
I was trying to setup mirage in a react native application as shown below for development using API stubs Since I am integrating mirage in an existing application, I am using pass through to allow the API calls which are available in the backend already.
export function makeServer({environment = 'development'} = {}) {
return createServer({
routes() {
this.logging = true;
this.get(
`https://my_server/groups`,
() => {
return {
"groupName": "GROUP_NAME"
};
}
);
//this.passthrough();
this.passthrough('https://codepush.appcenter.ms/**');
this.passthrough('https://my_server/**');
}
});
}
We are seeing the below error when an API call goes through passthrough which is resulting in a Native exception and a failure of the API call
Mirage: Passthrough request for GET https://codepush.appcenter.ms/v0.1/public/codepush/update_check
ReactNative: Exception in native call
java.lang.NullPointerException: Attempt to invoke virtual method 'double java.lang.Double.doubleValue()' on a null object reference
at com.facebook.react.bridge.ReadableNativeArray.getDouble(ReadableNativeArray.java:91)
at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:63)
at com.facebook.react.bridge.JavaMethodWrapper$4.extractArgument(JavaMethodWrapper.java:59)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:355)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:150)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
at android.os.Looper.loop(Looper.java:216)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
at java.lang.Thread.run(Thread.java:764)
React Native: 0.61.2 MirageJS: 0.1.41
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Win10 Electron Error: Passthrough is not supported, GL is ...
You can try disabling hardware acceleration using app.disableHardwareAcceleration() (See the docs). I don't think this is a fix though, ...
Read more >Forwarding Refs - React
Ref forwarding is a technique for automatically passing a ref through a component to one of its children. This is typically not necessary...
Read more >The app references non-public sele… | Apple Developer Forums
Apple Store connect operation error The app references non-public selectors in Payload/carchaze.app/carchaze: isPassthrough, ...
Read more >Troubleshooting - React Native
If you encounter an error such as npm WARN locking Error: EACCES while using the React Native CLI, try running the following:.
Read more >Handling different type of errors in React Native - MCRO
Handling these types of errors can sometimes become pretty complicated and this can lead to complex and hard-to-read code. How to implement it....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok everyone, I found the reason for this error. It took waaaaay longer than I expected but I found the root cause. Please refer to this PR in the Pretender repo. It’d be awesome if this got expedited so feel free to reach out to those necessary to review it.
I must say I learned a lot, and kinda proud I found this, my first bug fix on a public project. 😅
Same as above. Works on iOS, fails on Android with the Java error already cited.
Mirage 0.1.41 RN 0.63.4