nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
640 stars 99 forks source link

FirebaseAuthError: There is no user record corresponding to the provided identifier. #633

Closed sniperadmin closed 1 year ago

sniperadmin commented 1 year ago

Issue details:

When enabling the functions module in firebase staging environment, the following error appears in a trigger:

console errors ```go FirebaseAuthError: There is no user record corresponding to the provided identifier. 17:48:55 I function[us-central1-AddUserRole] at C:\Users\Nasr\Desktop\egab-ui\functions\node_modules\firebase-admin\lib\auth\auth-api-request.js:550:15 17:48:55 I function[us-central1-AddUserRole] at C:\Users\Nasr\Desktop\egab-ui\functions\node_modules\firebase-admin\lib\auth\auth-api-request.js:1614:13 17:48:55 I function[us-central1-AddUserRole] at processTicksAndRejections (node:internal/process/task_queues:96:5) { 17:48:55 I function[us-central1-AddUserRole] errorInfo: { 17:48:55 I function[us-central1-AddUserRole] code: 'auth/user-not-found', 17:48:55 I function[us-central1-AddUserRole] message: 'There is no user record corresponding to the provided identifier.' 17:48:55 I function[us-central1-AddUserRole] }, 17:48:55 I function[us-central1-AddUserRole] codePrefix: 'auth' 17:48:55 I function[us-central1-AddUserRole] } ```

Version

@nuxtjs/firebase: ^8.2.2 firebase: ^9.9.4 nuxt: ^2.15.8

Reproduction Link

Steps to reproduce

when turning on the functions module in nuxt config:

firebase: {
  customEnv: true,
  config: {...},
  services: {
    functions: true
  }
}

just a simple trigger like the following will result in the error in both production and emulator modes @ firebase staging environment:

/**
 * ./functions/src/..../userTriggers.ts
 * Triggering this fn on user creation
 */
export const onAddUserRole = functions.auth.user().onCreate(async (authUser: UserRecord) => {
  console.info("auth user should be => ", authUser)
})
Note: Turning off the functions module solves it, but of course, the module is needed anyways 😄

What is Expected?

I expected the function not to break up

What is actually happening?

Function execution breaks up resulting in this error.

the code runs on firebase production environment smoothly. However, this shows up in the staging env.