firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

`onChildAdded` events not working in Database v9.8.4 SDK

Open marcgallego opened this issue 3 years ago • 5 comments

Describe your environment

  • Operating System version: macOS 12.4
  • Browser version: Chrome 103
  • Firebase SDK version: 9.8.4
  • Firebase Product: database

Describe the problem

After upgrading to version 9.8.4, onChildAdded events do not fire.

Steps to reproduce:

Update to version 9.8.4, without changing the source code.

Relevant Code:


  id.then((id) => {
    ref = ref(db, `path/${id}/other_path}`)
    onChildAdded(query(ref, limitToLast(1)), (snapshot) => {
      [...]
    }

marcgallego avatar Jul 07 '22 11:07 marcgallego

Hi @rorencio, thanks for reaching out. I tried replicating, but I wasn't able to reproduce the same behavior.

If I can replicate the issue, I can have a better look into it. Please share a minimal, but complete sample of a project that I can run locally.

jbalidiong avatar Jul 08 '22 16:07 jbalidiong

Hey @rorencio. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Jul 15 '22 01:07 google-oss-bot

Hi again, I am having issues to replicate the issue with a minimal sample project. As soon as I reduce it to a minimal project, everything works fine. Unfortunately, I can not share the full version of my project either. I have checked if it could have to do with the build tools I use, but the issue persists using CDNs. It also persists when using v9.9.0.

marcgallego avatar Jul 15 '22 14:07 marcgallego

Thanks for the update, I've run a simple code and it is working fine on my end. I'm uncertain as to the cause of this inconsistent behavior. Let's leave the issue open for now, in case some of our engineers have an idea what caused this. Feel free to add more details. Thanks!

jbalidiong avatar Jul 15 '22 16:07 jbalidiong

This seems to be the only PR added in the 9.8.4 release, I'm not sure if anything in that would cause this effect. https://github.com/firebase/firebase-js-sdk/pull/6273

hsubox76 avatar Jul 15 '22 20:07 hsubox76

@rorencio - do you know if you were using get() in combination with onChildAdded? There was a bug where if a listener was called on a child path of a pending get then the listener's events wouldn't fire. Or, if you know the last working version of this?

maneesht avatar Aug 22 '22 18:08 maneesht

Yes, that was totally my case as well! I've tried with the lastest version and it seems to work fine now! Thank you very much!

marcgallego avatar Aug 23 '22 12:08 marcgallego