react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

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.

Open Twinski opened this issue 9 years ago • 34 comments

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 )

Twinski avatar Jul 06 '17 13:07 Twinski

Hey, what RN version are you running + OS?

Ehesp avatar Jul 06 '17 13:07 Ehesp

Hey man!

Deployment target: iOS 8.0

And according to package.json:

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

Twinski avatar Jul 06 '17 16:07 Twinski

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

chrisbianca avatar Jul 10 '17 08:07 chrisbianca

I’m using version 2.0.0 Thanks for looking into this ;) Appreciate it.

On Mon, Jul 10, 2017 at 10:08, chrisbianca [email protected] wrote: @Twinski [https://github.com/twinski] can I just check what version of react-native-firebase you're using?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [https://github.com/invertase/react-native-firebase/issues/233#issuecomment-314035326] , or mute the thread [https://github.com/notifications/unsubscribe-auth/ABcvwFZiUmXPqTv7m6Z3aOYXWQpXvy5eks5sMdwAgaJpZM4OPpLl] .

Twinski avatar Jul 11 '17 07:07 Twinski

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

chrisbianca avatar Jul 12 '17 08:07 chrisbianca

It’s a bit unclear really. The app doesn’t crash. It’s logging these events all the time. Maybe I have a debug option turned on for firebase? Is that possible?

On Wed, Jul 12, 2017 at 10:55, chrisbianca [email protected] wrote: @Twinski [https://github.com/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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [https://github.com/invertase/react-native-firebase/issues/233#issuecomment-314699673] , or mute the thread [https://github.com/notifications/unsubscribe-auth/ABcvwPKIJ-UM1Y3ibrT9xa7zxCno2gJ9ks5sNIn7gaJpZM4OPpLl] .

Twinski avatar Jul 12 '17 09:07 Twinski

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 :)

chrisbianca avatar Jul 12 '17 10:07 chrisbianca

I have no clue what you are talking about but sounds cool! ;) Good luck and hope to see it resolved soon. Keep up the great work!

On Wed, Jul 12, 2017 at 12:59, chrisbianca [email protected] wrote: 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 :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub [https://github.com/invertase/react-native-firebase/issues/233#issuecomment-314733807] , or mute the thread [https://github.com/notifications/unsubscribe-auth/ABcvwLQ3TDdOURWG_SNiEVdDnfD6ZeoJks5sNKcGgaJpZM4OPpLl] .

Twinski avatar Jul 13 '17 09:07 Twinski

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

chrisbianca avatar Jul 19 '17 15:07 chrisbianca

@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

jpokrzyk avatar Jul 22 '17 04:07 jpokrzyk

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

chrisbianca avatar Jul 22 '17 08:07 chrisbianca

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

jpokrzyk avatar Jul 22 '17 15:07 jpokrzyk

@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 avatar Jul 29 '17 13:07 jpokrzyk

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

jpokrzyk avatar Jul 29 '17 14:07 jpokrzyk

@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?

chrisbianca avatar Jul 31 '17 09:07 chrisbianca

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 avatar Sep 02 '17 20:09 DaBs

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.

DaBs avatar Sep 07 '17 15:09 DaBs

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

mikesurowiec avatar Sep 07 '17 18:09 mikesurowiec

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

DaBs avatar Sep 07 '17 18:09 DaBs

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

mikesurowiec avatar Sep 07 '17 19:09 mikesurowiec