-
Notifications
You must be signed in to change notification settings - Fork 191
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
@segment/analytics-react-native-plugin-braze - Invariant Violation: new NativeEventEmitter()
requires a non-null argument.,
#888
Comments
I thought I might try adding the import to one of our existing app components and trying to run the unit tests for that component - it fails with this output: Summary of all failing tests
|
@Jack-Gill-TH thanks for the report. The plugin right now is capped to v5 of Braze's SDK so downgrading is a good step. The error itself gives me the impression something might be off in the Braze SDK integration itself, as we don't directly call the |
Hi @oscb thanks so much for taking the time to respond! I've commented out the 'new NativeEventEmitter' line that you pointed to in the Braze code and I can confirm that that's the problematic line, the app finishes bundling and no longer freezes at the splash screen when that line in removed (but obviously the Braze integration doesn't work!) After each change I make I remove and reinstall my node modules and pods, and run Product -> Clean in Xcode - is there anything else I should be doing to clean up potentially cached files? Here are my AppDelegate header and body files, I've been trying to figure out if there's an obvious difference between them and the ones in your example project, but I'd definitely appreciate you taking a look: https://drive.google.com/drive/folders/1hRVjZYsGNHjFJwZRbIOppcZQV-Htb-KZ?usp=sharing I've also included a screenshot of the iOS device log, after I set the Braze logging to debug - nothing seems obviously amiss to me there. |
Also, these AppDelegate files are very old and cluttered, apologies for that 😅 |
Also, I've raised a ticket on the braze-react-native-sdk github, as it seems like this is more closely related to their code! braze-inc/braze-react-native-sdk#233 A little bit of extra info: If I add a new bit of code to the constructor of my main App file to import NativeModules.BrazeReactBridge and create a NativeEventEmitter with it, it does not throw an error. Also, I can log out the BrazeReactBridge and see that it is NOT null, so it seems like some kind of race condition? The BrazeReactBridge is null when the Braze class from your sdk is instantiated. |
Addresses in PR #969 |
Hello! I'm hoping someone might be able to help me with an issue I'm experiencing while trying to integrate the Braze plugin. The app I'm using already uses segment and the segment firebase plugin successfully, and I am able to follow all the steps that are outlined in the Segment/Braze documentation for integrating the Braze SDK and the Braze Segment plugin. Everything works correctly for Android, however it does not work on iOS.
The app builds and runs fine on iOS with all of the native Braze install steps. However, as soon as I add the Braze plugin import to the JavaScript, it causes the app to freeze right after the bundle finishes loading. I also get a new error reported in Metro:
ERROR Invariant Violation:
new NativeEventEmitter()
requires a non-null argument., js engine: hermesWARN Module RNEventEmitter requires main queue setup since it overrides
constantsToExport
but doesn't implementrequiresMainQueueSetup
. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.WARN Module RNLocalization requires main queue setup since it overrides
constantsToExport
but doesn't implementrequiresMainQueueSetup
. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
Specifically, the mention of 'Invariant Violation:
new NativeEventEmitter()
' and the 'Invariant Violation: Module AppRegistry is not a registered callable module' is new.I think it's likely that this relates to incompatibility between the new segment libraries and my app's RN version (which is embarrassingly old) but if anyone has any insight it would be much appreciated.
Here is a list of what I believe are the relevant dependencies:
The text was updated successfully, but these errors were encountered: