Skip to content

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

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

Closed
choang10 opened this issue Sep 13, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@choang10
Copy link

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

@triniwiz triniwiz added the bug Something isn't working label Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants