question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't create user with `phoneNumber: null`

See original GitHub issue

Describe your environment

  • Operating System version: macOS Monterey 12.0.1
  • Firebase SDK version: 9.10.0
  • Firebase Product: auth
  • Node.js version: 12.22.3
  • NPM version: 6.14.13

Describe the problem

I receive the following error when creating a user with phoneNumber: null:

FirebaseAuthError: The phone number must be a non-empty E.164 standard compliant identifier string.

But the function params say it should be allowed:

https://github.com/firebase/firebase-admin-node/blob/aea280d325c202fedc3890850d8c04f2f7e9cd54/src/auth/auth-config.ts#L160

Steps to reproduce:

Run the code below.

Relevant Code:

import firebase from 'firebase-admin'

await firebase.auth().createUser({
  displayName: 'John',
  email: 'john@example.com',
  phoneNumber: null,
})

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hiranya911commented, Dec 2, 2021

I don’t think it makes any sense to “create” a user with a null phone number. It’s same as creating one with no phone number specified. In case of update it specifically means to remove the phone number from the account.

0reactions
gustavopchcommented, Dec 3, 2021

@hiranya911 For example, there’s nothing wrong with:

await firebase
  .firestore()
  .collection('users')
  .add({
    displayName: 'John',
    email: 'john@example.com',
    phoneNumber: null,
  })

In fact, that’s sometimes even necessary if you need to filter on phoneNumber — if the property is just omitted, it won’t be indexed.

If null makes sense when adding a user to Firestore, intuitively, it also makes sense for Firebase Auth. I understand those are two different services with different implementations, but I’m talking from the perspective of someone who’s looking from the outside, consuming them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase phone number authentication getting null reference
I am trying to run my application on the physical device when I try to login using the phone number and received an...
Read more >
Manage Users | Firebase Authentication - Google
Set to null to clear the user's existing phone number. password, string, The user's new raw, unhashed password. Must be at least six...
Read more >
Blank, Coalesce, IsBlank, and IsEmpty functions in Power ...
Tests whether a value is blank or a table contains no records, and provides a way to create blank values.
Read more >
User pool attributes - Amazon Cognito
Attributes are pieces of information that help you identify individual users, such as name, email address, and phone number. A new user pool...
Read more >
User management - Firebase Admin SDK for PHP
You can also filter by email, phone number or uid: ... When a user doesn't exist, no exception is thrown, but its entry...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found