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

Requiring module 'NativeModules' by name - arguments[0].indexOf is undefined #14364

Closed
ben-snaize opened this issue Jun 7, 2017 · 6 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ben-snaize
Copy link

ben-snaize commented Jun 7, 2017

Hi,

Seeing an odd issue in RN 0.42 (since upgrading from 0.38, I believe).

I can't replicate the crash locally in debug or release which makes things difficult, but on both iOS and Android I'm seeing the following logged from Crashlytics. Both apps run through flawlessly locally, on device and via TestFlight / Play Store beta, yet something like like 1 in 20 users of the live Apps are crashing due to this:

RCTFatalException: Unhandled JS Exception: arguments[0].indexOf is not a function. (In 'arguments[0].indexOf("Requiring module 'NativeModules' by name")', 'arguments[0].indexOf' is undefined)

This seems to be stemming from here in index.[os].bundle.js where arguments[0].indexOf is called.

console.warn = function () {
    if (arguments[0] && arguments[0].indexOf('Requiring module \'NativeModules\' by name') > -1) return;
    return originalWarn.apply(console, arguments);
};

Does anyone have an idea of what could the cause of this? Why would arguments[0].indexOf be undefined at this stage?

I know the crash is very context dependent but some sort of pointer would be of great help.

@ben-snaize ben-snaize changed the title Requiring module 'NativeModules' by name Requiring module 'NativeModules' by name - arguments[0].indexOf is undefined Jun 7, 2017
@hramos
Copy link
Contributor

hramos commented Jun 7, 2017

This issue looks like a question that would be best asked on StackOverflow.

StackOverflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

Will close this as this is really a question that should be asked on StackOverflow.

@hramos hramos closed this as completed Jun 7, 2017
@ben-snaize
Copy link
Author

Thanks, I'm active on SO. I'll post there.

@IrinaCodixis
Copy link

Hi @ben-snaize .
I am experiencing the same issue. Did you manage to find the solution?

@ben-snaize
Copy link
Author

ben-snaize commented Jun 28, 2017

@IrinaCodixis For our production code, removing all calls to console.warn/console.log was the solution. These shouldn't be in the prod code anyway :)

@koenpunt
Copy link
Contributor

koenpunt commented Nov 6, 2017

FYI, it's probably because of this module: https://github.com/jhen0409/rn-host-detect/blob/master/index.js#L44

@ben-snaize
Copy link
Author

Turns out console.warn and Code Push bundling are the cause here. Solution is to remove the warns

@facebook facebook locked as resolved and limited conversation to collaborators Jun 7, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants