使用 next-firebase-auth 获得 auth/argument-error

get auth/argument-error with next-firebase-auth

问题:

当我尝试使用 firebase 身份验证登录时出现以下错误。当我使用 firebase auth 模拟器登录时一切都很好,但在不使用 auth 模拟器的情况下使用时会出现错误。我还从浏览器控制台收到了 500 response from login API endpoint: {"error":"Unexpected error."},我认为该错误与 next-firebase-auth 高度相关。

FirebaseAuthError: `uid` argument must be a non-empty string uid.
at FirebaseAuthError.FirebaseError [as constructor] (D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\firebase-admin\lib\utils\error.js:44:28)
at FirebaseAuthError.PrefixedFirebaseError [as constructor] (D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\firebase-admin\lib\utils\error.js:90:28)
at new FirebaseAuthError (D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\firebase-admin\lib\utils\error.js:149:16)
at FirebaseTokenGenerator.createCustomToken (D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\firebase-admin\lib\auth\token-generator.js:101:19)
at Auth.BaseAuth.createCustomToken (D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\firebase-admin\lib\auth\base-auth.js:87:36)
at D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\next-firebase-auth\build\index.node.js:2:22240
at Generator.next (<anonymous>)
at asyncGeneratorStep (D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:24)
at _next (D:\Alston\Programming\Personal-Project\netflix-clone\node_modules\@babel\runtime\helpers\asyncToGenerator.js:25:9)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
 errorInfo: {
   code: 'auth/argument-error',
   message: '`uid` argument must be a non-empty string uid.'
 },
   codePrefix: 'auth'
 }

我已经完全按照 official example 设置了我的 /api/login 页面。我尝试使用 signInWithEmailAndPasswordsignInWithPopup (使用 Google 进行身份验证),两者都成功登录,因为 console.log(results) 显示用户凭据,我也可以在 indexed DB 中找到相关数据。

包的版本

主要问题出在 login page,下面是 Github Repo.

我终于在 github 上找到了解决方案,删除了 .env.local 文件中的 FIREBASE_AUTH_EMULATOR_HOST=localhost:9099,一切又回到了正轨, 好奇怪的问题。