Skip to content

Auth reports 'auth/internal-error' when 'auth/user-not-found' expected #1346

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
wtpalexander opened this issue Jun 24, 2021 · 1 comment
Closed

Comments

@wtpalexander
Copy link

[READ] Step 1: Are you in the right place?

  • For issues related to the code in this repository file a Github issue.
  • If the issue pertains to Cloud Firestore, read the instructions in the "Firestore issue"
    template.
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general Firebase discussion, use the firebase-talk
    google group.
  • For help troubleshooting your application that does not fall under one
    of the above categories, reach out to the personalized
    Firebase support channel.

[REQUIRED] Step 2: Describe your environment

  • Operating System version: Mac OSX 11.4
  • Firebase SDK version: 9.2.0
  • Firebase Product: Auth
  • Node.js version: v14.15.4
  • NPM version: 6.14.10

[REQUIRED] Step 3: Describe the problem

Running a firebase function on emulators, using the Admin SDK to generate a password reset email calling await admin.auth().generatePasswordResetLink(email, actionCodeSettings) the error returned when the email address doesn't match any users in the database causes an internal ('auth/internal-error') error rather than returning the expected 'auth/user-not-found'.

Steps to reproduce:

Trigger a function running using the emulator, that generates the password reset link for an account that doesn't exist.

Relevant Code:

Console logs when the error is reported:

>  FirebaseAuthError: An internal error has occurred. Raw server response: "{"error":{"code":400,"message":"EMAIL_NOT_FOUND","errors":[{"message":"EMAIL_NOT_FOUND","reason":"invalid","domain":"global"}]}}"
>      at FirebaseAuthError.FirebaseError [as constructor] (/Users/wtpalexander/APPSTRM Dev/Progression/Firebase/functions/node_modules/firebase-admin/lib/utils/error.js:44:28)
>      at FirebaseAuthError.PrefixedFirebaseError [as constructor] (/Users/wtpalexander/APPSTRM Dev/Progression/Firebase/functions/node_modules/firebase-admin/lib/utils/error.js:90:28)
>      at new FirebaseAuthError (/Users/wtpalexander/APPSTRM Dev/Progression/Firebase/functions/node_modules/firebase-admin/lib/utils/error.js:149:16)
>      at Function.FirebaseAuthError.fromServerError (/Users/wtpalexander/APPSTRM Dev/Progression/Firebase/functions/node_modules/firebase-admin/lib/utils/error.js:188:16)
>      at /Users/wtpalexander/APPSTRM Dev/Progression/Firebase/functions/node_modules/firebase-admin/lib/auth/auth-api-request.js:1526:49
>      at processTicksAndRejections (internal/process/task_queues.js:97:5)
>      at async /Users/wtpalexander/APPSTRM Dev/Progression/Firebase/functions/user-management.js:72:26
>      at async func (/Users/wtpalexander/APPSTRM Dev/Progression/Firebase/functions/node_modules/firebase-functions/lib/providers/https.js:273:26) {
>    errorInfo: {
>      code: 'auth/internal-error',
>      message: 'An internal error has occurred. Raw server response: "{"error":{"code":400,"message":"EMAIL_NOT_FOUND","errors":[{"message":"EMAIL_NOT_FOUND","reason":"invalid","domain":"global"}]}}"'
>    },
>    codePrefix: 'auth'
>  }
@hiranya911
Copy link
Contributor

Fixed in #1246. Available in releases v9.8.0 and up.

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