Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Module exports two methods to JavaScript with the same name: "setUserId" #163

Closed
2 of 3 tasks
kareem-adel opened this issue May 26, 2024 · 6 comments
Closed
2 of 3 tasks
Labels

Comments

@kareem-adel
Copy link

kareem-adel commented May 26, 2024

Documentation

  • I've checked the guide, but it doesn't help me to resolve the issue.

Description

When enabling new architecture in android I'm getting in logcat:
Error: Exception in HostObject::get for prop 'Pushwoosh': com.facebook.react.internal.turbomodule.core.TurboModuleInteropUtils$ParsingException: Unable to parse @ReactMethod annotations from native module: Pushwoosh. Details: Module exports two methods to JavaScript with the same name: "setUserId"

Bug severity

High

Steps to Reproduce

  1. Enable new architecture on android
  2. Build and run the app

Your Pushwoosh React Native Plugin version

6.1.30

Last worked Pushwoosh React Native Plugin version (if any)

No response

Affected platforms

  • Android
  • iOS

Affected OS versions and/or devices

Pixel 3a API 34

Workaround

Commenting:
//@ReactMethod
//public void setUserId(String userId) {
// PushwooshInApp.getInstance().setUserId(userId);
//}

Relevant log output

Error: Exception in HostObject::get for prop 'Pushwoosh': com.facebook.react.internal.turbomodule.core.TurboModuleInteropUtils$ParsingException: Unable to parse @ReactMethod annotations from native module: Pushwoosh. Details: Module exports two methods to JavaScript with the same name: "setUserId"

@wfhm
Copy link
Member

wfhm commented May 28, 2024

@kareem-adel Hi,
The plugin indeed has 2 setUserId methods exported, but this code is more than 4 years old and we have never received any similar reports so far. Also, I could not reproduce the issue on my side with the latest React Native version. Could you please specify what React Native version you are using in your project?

@Grohden
Copy link

Grohden commented Jun 25, 2024

Hey @wfhm maybe this is caused by the new arch (fabric I guess)... I don't use this package but I have a similar log for another one

E | ReactNativeJS ▶︎ Error: Exception in HostObject::get for prop 'UserLeapBindings': com.facebook.react.internal.turbomodule.core.TurboModuleInteropUtils$ParsingException: Unable to parse @ReactMethod annotations from native module: UserLeapBindings. Details: Module exports two methods to JavaScript with the same name: "configure

Seems somehow the TurboModuleInteropUtils parser doesn't understand what a method overload is anymore? 😞

I don't see anything suspicious here though

@connorpmullins
Copy link

I'm seeing a similar issue with the Iterable package. Have any of you found a fix?

@Grohden
Copy link

Grohden commented Jun 26, 2024

@connorpmullins I've looked at the history of that file and it seems that it was there since it was implemented... (by @RSNara in facebook/react-native@1f7daf9) so I guess this is a breaking change... and a big one cuz any sane person in java would use method overloads 😞 (but I guess it makes sense for cross communication between js and java... or they just assume packages use kotlin)

My fix is a patch package (https://docs.sprig.com/discuss/667b2e307ac21e0018f77f68) for the specific reported package unifying the signatures and assuming the diff in the argument will be null.

However I've gave up in using the new arch since its not supported by the bottom sheet package we're using.

@connorpmullins
Copy link

Thanks @Grohden - I'll pass this over to the new arch discussion group and see if anyone else is encountering similar issues.

@enginseer-dev
Copy link

Hello @kareem-adel, @Grohden and @connorpmullins! We've fixed the issue with the newest release 6.1.32, please update the plugin in your apps and let us know if the issue persists.

@wfhm wfhm closed this as completed Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants