gladly-team / next-firebase-auth

Simple Firebase authentication for all Next.js rendering strategies
https://nfa-example-git-v1x-gladly-team.vercel.app/
MIT License
1.34k stars 291 forks source link

why doesn't create cookies in localhost after added firestore and SSR #571

Closed thanhtutzaw closed 1 year ago

thanhtutzaw commented 1 year ago

Strange bugs in localhost after SSG , ISR , Firestore in my device

Describe the bug First I connect firestore for data fetching after auth . then I write some SSR code and It works . then everything is crazy in Localhost .

  1. it doesn't redirect after auth
  2. it doesn't create cookies but it create firebase indexDB stuff
  3. I can confirm it happens in localhost , also in example app with same firebase config
  4. you can find my last (no error version) github file in here
  5. error happened when doing firestore , ssr and isr stuff in Localhost
  6. now my whole device have this error . also in official next-firebase-auth example app . I think I have problem in firebase account . But only error in localhost .

Versions

next-firebase-auth version: ^1.0.0-canary.9 Firebase JS SDK: 9.9 Next.js: 12.1

Expected behavior It should be create cookies and redirect to app after auth .

Debug and error logs Error: Received 500 response from login API endpoint: {"error":"Unexpected error when Login"}

FirebaseAuthError: uid argument must be a non-empty string uid. at FirebaseTokenGenerator.createCustomToken (D:\React\Next\too\node_modules\firebase-admin\lib\auth\token-generator.js:99:19) at Auth.createCustomToken (D:\React\Next\too\node_modules\firebase-admin\lib\auth\base-auth.js:88:36) errorInfo: { code: 'auth/argument-error', message: 'uid argument must be a non-empty string uid.' }, codePrefix: 'auth' }

Additional context in Network tab after logged in , login api is pending and after 20s it says status 500 error in login API endpoint. Screenshot (75) Screenshot (69)