【发布时间】:2022-02-09 22:57:15
【问题描述】:
问题:
当我尝试使用 firebase auth 登录时,出现以下错误。当我使用 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'
}
我已将/api/login 页面设置为与official example 完全相同。我尝试使用signInWithEmailAndPassword 和signInWithPopup (使用Google 进行身份验证),两者都成功登录,因为console.log(results) 显示了用户凭据,我还可以在@987654332 中找到相关数据@也是。
包的版本
"next-firebase-auth": "^1.0.0-canary.5""firebase-admin": "^10.0.2","firebase": "^9.6.1",
主要问题在于login page,这是 Github Repo.
【问题讨论】:
-
你能分享你的代码吗?
-
是的,我刚刚添加了 GitHub 存储库并进行了编辑。
-
您可以在这里复制导致问题的部分或提供直接链接吗?
标签: javascript firebase firebase-authentication next.js