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

Error handlers no longer being called for reference listeners, permission denied causes crash #4818

Closed
joekrill opened this issue Apr 21, 2021 · 2 comments · Fixed by #4832
Closed

Comments

@joekrill
Copy link

Describe your environment

  • Operating System version: macOS 11.2.3 (20D91)
  • Browser version: Chrome 89.0.4389.128 (Official Build) (x86_64)
  • Firebase SDK version: 8.4.0
  • Firebase Product: database

Describe the problem

Attempting to read from a ref with no read permission results in an error: Uncaught TypeError: Cannot read property 'hasCancelCallback' of undefined. Stack trace I'm seeing is:

Uncaught TypeError: Cannot read property 'hasCancelCallback' of undefined
    at ChildEventRegistration.createCancelEvent (index.esm.js:13164)
    at index.esm.js:9384
    at Array.forEach (<anonymous>)
    at viewRemoveEventRegistration (index.esm.js:9383)
    at syncPointRemoveEventRegistration (index.esm.js:9596)
    at syncTreeRemoveEventRegistration (index.esm.js:9900)
    at onComplete (index.esm.js:10200)
    at Object.onComplete (index.esm.js:11199)
    at index.esm.js:3351
    at PersistentConnection.onDataMessage_ (index.esm.js:3566)
    at Connection.onDataMessage_ (index.esm.js:2411)
    at Connection.onPrimaryMessageReceived_ (index.esm.js:2405)
    at WebSocketConnection.onMessage (index.esm.js:2307)
    at WebSocketConnection.appendFrame_ (index.esm.js:1917)
    at WebSocketConnection.handleIncomingFrame (index.esm.js:1965)
    at WebSocket.mySock.onmessage (index.esm.js:1864)

The cancelCallbackOrContext is no longer being called, either.

Previously the error was effectively ignored (and certainly didn't cause the running script to crash), and if a cancelCallbackOrContext parameter was provided, it was called.

I confirmed this works in SDK v8.3.3.

Steps to reproduce:

  • Update to firebase@8.4.1.
  • Add a child_added event listener to a path in which the authenticated user does not have read access

Relevant Code:

firebase.database().ref("/some/path/with/no/read/access").on("child_added", () => {
}, (error) => {
  // This gets called in SDK v8.3.3 and earlier, but not after 8.4.0
});
@joekrill joekrill changed the title Error handlers no longer being called for reference listeners, permission causes crash Error handlers no longer being called for reference listeners, permission denied causes crash Apr 21, 2021
@looptheloop88
Copy link

Hi @joekrill, thanks for the report. I was able to replicate the behavior where the error could no longer be caught in the callback using SDK version 8.4.1.

I've filed an internal bug for this issue. Please use the working version for the meantime.

@schmidt-sebastian
Copy link
Contributor

We will get this fixed in the next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants