nextjs-now-firebase icon indicating copy to clipboard operation
nextjs-now-firebase copied to clipboard

500 Server Error after Logging In

Open TylerMills opened this issue 4 years ago • 1 comments

I've setup everything according to the guide and it seems to be working. But I'm getting an error of:

POST http://localhost:3000/api/login 500 (Internal Server Error)

After logging in successfully on every page. What's odd is all the user profile data is returned successfully... and I'm able to log out and log back in.

I tracked it down and it appears that the utils/auth/hooks.ts file and this function are causing the problem:

  setState({ initializing: false, user });

  // Call server to update session.
  setSession(user);
}

When I uncomment the setSession(user) line the error goes away but it also doesn't seem to impact the authentication functionality. Should this be conditionally excluded for only being called on login and not every other type of change?

TylerMills avatar Apr 19 '20 18:04 TylerMills