Skip to content

firebase/auth TypeError: Cannot read property 'enumerateObjectsUsingBlock' of null #131

Closed
@choang10

Description

@choang10

Hi, I'm trying out the Firebase flow in a test app and I'm running into this error, calling "fetchSignInMethodsForEmail" when providing an email that hasn't registered with my app.

Expected behavior: fetchSignInMethodsForEmail should resolve to an empty array when the SDK method returns null.
Actual behavior: app crashes with "TypeError: Cannot read property 'enumerateObjectsUsingBlock' of null."

Here's the method in question (line 911): https://github.com/NativeScript/firebase/blob/main/packages/firebase-auth/index.ios.ts#:~:text=fetchSignInMethodsForEmail

A quick check for truthiness or an explicit null check should be sufficient:

this.native.fetchSignInMethodsForEmailCompletion(email, (emails, error) => { if (error) { reject(FirebaseError.fromNative(error)); } else { const arr = []; if (emails) { emails.enumerateObjectsUsingBlock((email) => { arr.push(email); }); } resolve(arr); } });

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions