Skip to content
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

Find or delete non-existing UID results to prevent an uncacheable error. #2845

Open
bfzli opened this issue Feb 10, 2025 · 1 comment
Open

Comments

@bfzli
Copy link

bfzli commented Feb 10, 2025

Platform:

  • Operating System version: MacOs - Darwin 23.6.0 arm64 arm
  • Firebase SDK version: 11.11.1
  • Firebase Product: Firebase Auth
  • Bun version: 1.2.2 (Don't think is related)
  • NPM version: 10.8.2

Problem:
Whenever I try to find a user that doesn't exist or delete a uid that doesn't exist it thorws an error that breaks the function and is not cachable for some reaons, and its very weird behavirous that im not able to handle, i tried to use try catch, and then catch, but still the same. This has no steep to reprpoduce the error, its default behaviour.

Code:

import { Firebase } from '@/libs/firebase'
import { Console } from '@/helpers/logs'

const admin = await Firebase()

const DeleteFirebaseAccount = async (uid: string): Promise<boolean> => {
    try {
        const userExists = await admin.auth().getUser(uid)
        if (userExists) await admin.auth().deleteUser(uid)

        return true
    } 
    
    catch (error) {
        Console.Error('DeleteFirebaseAccount', error)
        return false
    }
}

export default DeleteFirebaseAccount

The error:

class FirebaseError extends Error {
29 |     constructor(errorInfo) {
30 |         super(errorInfo.message);
             ^
error: There is no user record corresponding to the provided identifier.
  errorInfo: {
  code: "auth/user-not-found",
  message: "There is no user record corresponding to the provided identifier.",
},
 codePrefix: "auth",
@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants