firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 925 forks source link

updateProfile doesn't accept displayName null or photoURL null #6424

Open marcusx2 opened 1 year ago

marcusx2 commented 1 year ago

Operating System

macOS

Browser Version

Safari 16.5.2

Firebase SDK Version

10.3.0

Firebase SDK Product:

Auth

Describe your project's tooling

index.html with source tag.

Describe the problem

updateProfile's signature indicates that displayName and photoURL both can accept null, but they can't, because if you pass null to either of them you get FirebaseError: Firebase: Error (auth/invalid-json-payload-received.-/displayname-must-be-string). or FirebaseError: Firebase: Error (auth/invalid-json-payload-received.-/photourl-must-be-string). respectively.

Steps and code to reproduce issue

Assuming you already have a user1@test.com with 123456 password

var result = await signInWithEmailAndPassword(auth, "user1@test.com", "123456");
var user = result.user;
await updateProfile(user, { displayName: null, photoURL: null });
pragatimodi commented 11 months ago

Thanks for reporting this issue. I am unable to reproduce this error while trying to update user through the demo app. Can you please do the same and let me know if it still persists? Would recommend modifying the code in https://github.com/firebase/firebase-js-sdk/blob/eff95304d4881a65a6fc0015663d7873507f299a/packages/auth/demo/src/index.js#L1048, to pass null, instead of reading the value from "#display-name" text box to check.

marcusx2 commented 11 months ago

Maybe the error only happens with the emulator then.

prameshj commented 11 months ago

Transferring to emulator repo.

aalej commented 11 months ago

Hey @marcusx2, thanks for reporting this. I was able to replicate the issue when using the Firebase Auth emulator. When calling the updateProfile() and passing a null value for displayName and/or photoURL, an error is raised.

I’ll mark this issue as reproducible and inform our engineering team about the issue.