Skip to content

FR: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'id' of null #32

@djom202

Description

@djom202

Hello,

So I'm try to call the key in the snapshot but I get this error:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'id' of null

I'm using firebase-admin: 4.2.1 and nodejs 6.9.1, the firebase product is storage, I'm using MacOx and my code is:

var db = admin.database().ref('events/-KlGpV1rBu9iACpwdluZ').orderByKey(),
        deferred = Q.defer(),
        childData = null,
        info = [];

    db.once("value").then(function(snapshot) {
        snapshot.forEach(function(childSnapshot) {
            console.log('key', childSnapshot.key);
            console.log('val', childSnapshot.val());

            info.push(childSnapshot.key);
        });

        deferred.resolve(info);
    });

    return deferred.promise;

I have been reading all documentation about the key and I didn't found any issue in the code. Is possible that the problem is that the documentation is not updated or has issues?

Thanks

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions