这是indexloc提供的服务,不要输入任何密码
Skip to content

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

@joekrill

Description

@joekrill

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
});

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions