Skip to content

Debug logs not displayed when database connection cannot be made #675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 5 tasks
JLHasson opened this issue Sep 15, 2020 · 5 comments
Closed
1 of 5 tasks

Debug logs not displayed when database connection cannot be made #675

JLHasson opened this issue Sep 15, 2020 · 5 comments
Labels
bug Something isn't working stale Did not receive any activity for 60 days

Comments

@JLHasson
Copy link
Contributor

JLHasson commented Sep 15, 2020

Describe the bug
I am getting an error during sign in that results in landing at /api/auth/signin?error=Callback after the call. I have narrowed this down to being a database connection issue (if I remove database: {...} from my options I am able to sign in successfully). I have debug: true in my options yet when I get returned back to /api/auth/signin?error=Callback there are no debug logs. If I disable the database connection (as mentioned above) I do see the debug logs, so it would appear that when I am unable to make a db connection something is preventing the error logs from being logged.

Steps to reproduce
Steps to reproduce the behavior.

  1. Navigate to /api/auth/signin
  2. Click "Sign in with Github"
  3. Authorize Github Oauth application
  4. Be returned back to /api/auth/signin?error=Callback

Expected behavior
A clear and concise description of what you expected to happen.

I should see the debug logs for the failed db connection in the console.

Screenshots or error logs
If applicable add screenshots or error logs to help explain the problem.

Instead I only get a status 200:
image

Additional context
Add any other context about the problem here.

This is on a Vercel deployment attempting to connect to a postgres hosted on Digital Ocean. The issue doesn't exist when developing locally.

Feedback
Documentation refers to searching through online documentation, code comments and issue history. The example project refers to next-auth-example.

  • Found the documentation helpful
  • Found documentation but was incomplete
  • Could not find relevant documentation
  • Found the example project helpful
  • Did not find the example project helpful
@JLHasson JLHasson added the bug Something isn't working label Sep 15, 2020
@JLHasson
Copy link
Contributor Author

Actually, if I narrow my database instance "allow IP ranges" to something really restrictive (i.e. only my local machine's IP) I get a 502 bad gateway error (similar to mentioned here: #660). If I open the instance up to all IPs, then I get the issue I've described above. So I guess what I really want to know is how to get debug info when I land at /api/auth/signin?error=Callback? Because right now I don't get any info in the server logs or in the console

@JLHasson
Copy link
Contributor Author

Ok, an update. The issue was indeed due to a poorly configured database connection. Once I resolved the database connection issue I was able to login without the error. My particular issue was that I was passing the wrong ssl: {...} config. I think I would still consider this a bug, as the docs say that next-auth should pass the error up and log it in the console, but for my issue there were no logs surfaced and I just ended up at signin?Error=Callback with no other info.

@iaincollins
Copy link
Member

Thanks for the report.

I agree we need additional debug error handling for authentication flows, as mostly it's just around database interactions right now (which also assumes you are using a database, and doesn't help with debugging oAuth problems).

@stale
Copy link

stale bot commented Dec 5, 2020

Hi there! It looks like this issue hasn't had any activity for a while. It will be closed if no further activity occurs. If you think your issue is still relevant, feel free to comment on it to keep ot open. Thanks!

@stale stale bot added the stale Did not receive any activity for 60 days label Dec 5, 2020
@stale
Copy link

stale bot commented Dec 12, 2020

Hi there! It looks like this issue hasn't had any activity for a while. To keep things tidy, I am going to close this issue for now. If you think your issue is still relevant, just leave a comment and I will reopen it. (Read more at #912) Thanks!

@stale stale bot closed this as completed Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Did not receive any activity for 60 days
Projects
None yet
Development

No branches or pull requests

2 participants