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

An error occurred in sendJSEvent: bridge is not set. This is probably because you've explicitly synthesized the bridge in RNFirebaseDatabase, even though it's inherited from RCTEventEmitter. #233

Closed
Twinski opened this issue Jul 6, 2017 · 34 comments
Assignees
Labels
platform: ios plugin: database Firebase Realtime Database Workflow: Waiting for User Response Blocked waiting for user response.

Comments

@Twinski
Copy link

Twinski commented Jul 6, 2017

This keeps coming up in my logs of XCode. Anyone has a clue what is going on?

Full console warning:
An error occurred in sendJSEvent: bridge is not set. This is probably because you've explicitly synthesized the bridge in RNFirebaseDatabase, even though it's inherited from RCTEventEmitter. ( 0 CoreFoundation 0x000000010ecfcb0b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x000000010debc141 objc_exception_throw + 48 2 CoreFoundation 0x000000010ed00cf2 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000010da8b69f -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 165 4 Bookkee 0x000000010b048ee8 -[RCTEventEmitter sendEventWithName:body:] + 408 5 Bookkee 0x000000010afb729b -[RNFirebaseDBReference sendJSEvent:title:props:] + 315 6 Bookkee 0x000000010afb598a __51-[RNFirebaseDBReference addEventHandler:eventName:]_block_invoke + 602 7 Bookkee 0x000000010b2a797f __43-[FChildEventRegistration fireEvent:queue:]_block_invoke.55 + 88 8 libdispatch.dylib 0x00000001122a14a6 _dispatch_call_block_and_release + 12 9 libdispatch.dylib 0x00000001122ca05c _dispatch_client_callout + 8 10 libdispatch.dylib 0x00000001122ab40b _dispatch_main_queue_callback_4CF + 411 11 CoreFoundation 0x000000010ecc1909 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 12 CoreFoundation 0x000000010ec87ae4 __CFRunLoopRun + 2164 13 CoreFoundation 0x000000010ec87016 CFRunLoopRunSpecific + 406 14 GraphicsServices 0x0000000112dada24 GSEventRunModal + 62 15 UIKit 0x00000001108f40d4 UIApplicationMain + 159 16 Bookkee 0x000000010aedc03f main + 111 17 libdyld.dylib 0x000000011083965d start + 1 18 ??? 0x0000000000000002 0x0 + 2 )

@Ehesp
Copy link
Member

Ehesp commented Jul 6, 2017

Hey, what RN version are you running + OS?

@Twinski
Copy link
Author

Twinski commented Jul 6, 2017

Hey man!

Deployment target: iOS 8.0

And according to package.json:

"react": "16.0.0-alpha.12",
"react-native": "0.45.1",

@chrisbianca
Copy link
Contributor

@Twinski can I just check what version of react-native-firebase you're using?

@Twinski
Copy link
Author

Twinski commented Jul 11, 2017 via email

@chrisbianca chrisbianca added plugin: database Firebase Realtime Database platform: ios labels Jul 12, 2017
@chrisbianca
Copy link
Contributor

@Twinski Thanks for clarifying. Do you know what the app is trying to do when this error is displayed? Does the app crash when the error is thrown?

I'm struggling to reproduce myself.

@Twinski
Copy link
Author

Twinski commented Jul 12, 2017 via email

@chrisbianca
Copy link
Contributor

Ok, as the app doesn't crash, I think I know what is causing these warning messages to show. It's due to the fact that currently, the RNFirebaseDatabaseReference class is a part of the RNFirebaseDatabase class. The former does hold a reference to the bridge. If I refactor them, hopefully that will make the warning go away...

I've added it to my TODO list :)

@Twinski
Copy link
Author

Twinski commented Jul 13, 2017 via email

@chrisbianca
Copy link
Contributor

@Twinski I've just refactored RNFirebaseDatabase and RNFirebaseDatabaseReference to hopefully get rid of these warnings for you.

Are you able to test the latest version of the code. You can simply do:

npm install --save git+https://github.com/invertase/react-native-firebase.git

which will install the latest from the GitHub repo. Once you've confirmed, I'll release a new version.

@jpokrzyk
Copy link

jpokrzyk commented Jul 22, 2017

@chrisbianca I'm getting the following when I try and use the code in master via npm install --save git+https://github.com/invertase/react-native-firebase.git to see if this resolves the bug.

Let me know if there's any other info I can provide. Thanks for the awesome library.

image

@chrisbianca
Copy link
Contributor

@jpokrzyk Try running a pod install from the iOS directory. FNFirebaseDatabaseReference is a new file that's probably not been picked up.

@jpokrzyk
Copy link

jpokrzyk commented Jul 22, 2017

@chrisbianca Arg my native ios skills are limited but I should have known that.

Yep that resolved it for me and I don't see any new issues. Thanks again.

@Salakar Salakar closed this as completed Jul 24, 2017
@jpokrzyk
Copy link

@chrisbianca can this get pushed into a new release pretty soon? I'm pretty sure all the log dumping into the xcode because of this issue is causing a bunch of janky animations in our app.

We're probably going to do a release using master from this library but I have a feeling that's going to come back to bite us pretty soon (because we're not pinned to a version). Thanks!

@jpokrzyk
Copy link

@chrisbianca @Salakar Actually never mind on the release. Looks like this issue needs to be re-opened. I'm getting the following on 2.0.4. I didn't a way to reproduce this 100% of the time, but looks like I do now, and it's still an issue.

image

But I'm also concerned these large warning log dumps from this module is causing jankiness and freezing while the messages clear the log buffer. Any idea of this might be true? Or maybe it's chewing up the bandwidth on the RN js bridge?

My janky animations could definitely just be the old navigation library I'm using or other issues in the app. Just throwing out my observations in case they might be useful. We have reports of freezing and delays on our test flight builds and this library is one of a couple of new variables in the mix.

I have debug: false but that doesn't seem to suppress the warnings.

@chrisbianca
Copy link
Contributor

@jpokrzyk You would be getting that warning on 2.0.4 as that doesn't include the fix. I've just published a v2.0.5 release which includes the fix.

In terms of the logging - that is coming from React Native and not from RNFirebase. It will be disabled as part of the Release build so shouldn't be causing any issues with your TestFlight builds assuming you're doing Release builds and not Debug?

@DaBs
Copy link

DaBs commented Sep 2, 2017

This bug is still prevalent, even in 3.0.0-alpha2.

EDIT: And appears to be the main cause of a lot of crashes I'm getting. I'll investigate further, but I think the issue might need to be re-opened.

@DaBs
Copy link

DaBs commented Sep 7, 2017

Right now, my symbolicated error stack is saying it's coming from this line and a couple of the other places where events are being emitted.

EDIT: I see that we're getting the emitter from the database class and using that, but I'm suspecting that's where the issue lies currently. If it's of any help, I'm currently using React Native Navigation, which prompts a couple of uncommon implementation details, e.g. that Sentry gets the bridge fed directly. I'm thinking it might be related to that, but if OP was not using RNN, then we've got something else on our hands.

@Salakar Salakar reopened this Sep 7, 2017
@mikesurowiec
Copy link

I am getting a similar error - although it happens for me on iOS when I refresh the app.

My error stack is pointing here and here.

react-native-firebase: 3.0.0-alpha.3
react-native: 0.48.1

@DaBs
Copy link

DaBs commented Sep 7, 2017

@mikesurowiec Thanks for also reporting - you're using a "standard" navigation, yes? Because then your error message suggests that it is probably related to the event emitter going lost somewhere.

@mikesurowiec
Copy link

Yeah the navigation is done purely on the javascript side. I was upgrading from 2.x -> 3 and this is the only issue I've had so far. It's possible I have something else configured incorrectly, just weird that it works before a JS reload

@DaBs
Copy link

DaBs commented Sep 8, 2017

For now, this doesn't seem to affect production, but it makes the development experience on iOS a living hell, as all of the event emitters are causing crashes. I've forked the repo and will be trying to fix it, possibly by implementing RNFirebaseDatabaseReference as an RCTEventEmitter instead of an NSObject

@Salakar
Copy link
Member

Salakar commented Sep 8, 2017

Are you both on v3? Gonna take a look and see what I can do about this on v3, if it works then I can backport.

@DaBs
Copy link

DaBs commented Sep 8, 2017 via email

@chrisbianca
Copy link
Contributor

Is this still causing you problems?

I'm really unsure why this is happening - I'm unable to reproduce on v3 at all, which makes it hard to try and resolve the issue. This issue used to happen on v2 because RNFirebaseDatabaseReference was part of the RNFirebaseDatabase file rather than it's own file. Now that it's separate, the error that's being warned about shouldn't be the case.

@DaBs if you're able to share a basic project that this happens on we can more easily take a look?

@chrisbianca chrisbianca added the Workflow: Waiting for User Response Blocked waiting for user response. label Sep 23, 2017
@faahmad
Copy link

faahmad commented Sep 26, 2017

This is causing me issues in development as well. It doesn't happen every time, but I can sometimes reproduce by changing a value in my firebase console while the app is running on my device. I'll try to find a pattern in the crashes.

this is my error message:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bridge is not set. 

This is probably because you've explicitly synthesized the bridge in RNFirebaseDatabase, even though it's inherited from RCTEventEmitter.

also on v3 alpha3

@jmhuret
Copy link

jmhuret commented Sep 26, 2017

I am working from v3 and I see the same issues as @faahmad. It appears that it's only an issue after doing a JS reload (live, or manual). If I've done a fresh install of the app from XCode, everything seems to work fine.

@Salakar
Copy link
Member

Salakar commented Oct 2, 2017

Hey all, think we may have stumbled onto a fix for this, I'll be pushing something up tonight for this in prep for tomorrow's v3 beta release.

@Salakar Salakar self-assigned this Oct 2, 2017
@Salakar Salakar added this to the v3.0.0 milestone Oct 2, 2017
@jmhuret
Copy link

jmhuret commented Oct 4, 2017

I just updated to v3.0.0RC1 and it this issue seems to be working now. Thanks for getting the fix in there.

EDIT: I may have spoken too soon. Looks like I'm still seeing this sometimes. Particularly when I edit an entity on firebase, while using this app in debug mode, after a refresh (not a direct build).

@Salakar Salakar modified the milestones: v3.0.0 RC1, v3.0.x Release Oct 7, 2017
chrisbianca added a commit that referenced this issue Oct 12, 2017
@chrisbianca
Copy link
Contributor

I have just pushed up a fix for this and released as part of v3.0.3

@bsiddiqui
Copy link

@chrisbianca still having this issue #549

@chrisbianca chrisbianca removed this from the v3.2.0 Release milestone Nov 9, 2017
@benkraus
Copy link

I'm still seeing this as of 3.2.5. Any tips to get this resolved?

@chrisbianca
Copy link
Contributor

@benkraus Where are you seeing this? The DB or another module? Just iOS? Everything should now be protected against this error but we might have missed somewhere...

@xuezhy
Copy link

xuezhy commented Nov 5, 2020

@benkraus Hello, how did you solve this problem? I have a similar problem。RN Version:0.57.8

@mikehardy
Copy link
Collaborator

@xuezhy that version of react-native is so old I don't believe it works on Android 10 or 11, or ios 13 or 14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ios plugin: database Firebase Realtime Database Workflow: Waiting for User Response Blocked waiting for user response.
Projects
None yet
Development

No branches or pull requests