question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passthrough is resulting in error in native code for react native

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
bombillazocommented, Jul 21, 2021

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. 😅

gold1 3

3reactions
elliotmrodriguezcommented, May 12, 2021

Same as above. Works on iOS, fails on Android with the Java error already cited.

Mirage 0.1.41 RN 0.63.4

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found