question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Queries do not return if there was a connection error

See original GitHub issue

I don’t want my app to exit, if there’s an error in the db connection (so, users can be shown some 503 page). So, I listen on the connection error event, but I just log possible errors to the console.

Now, say db connect has failed, and a request comes in, the app queries the db (e.g. with <Model>.find), but the callback isn’t even called. So, the request just times out at some point…

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:9

github_iconTop GitHub Comments

4reactions
Billy-commented, Jun 1, 2018

I am encountering this issue… Is there a way to at least provide a timeout so that the query will fail / throw an error if the query takes too long?

1reaction
Dewbcommented, Oct 17, 2018

For posterity’s sake, it looks like an option to disable command buffering was indeed added: https://mongoosejs.com/docs/guide.html#bufferCommands

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connection Error after a few SQL Queries · Issue #135 - GitHub
i am receiving in my logs ConnectionError after a few scripts executions. but when i execute the SQL scripts one at a time...
Read more >
Troubleshoot query time-out errors - SQL Server
This article describes how to troubleshoot the time-out errors when you run slow-running queries.
Read more >
node.js mssql callback on connection error - Stack Overflow
return records as well as query and database connection errors. It returns records and query errors, but does not work for Connection errors...
Read more >
Handling operation errors - Apollo GraphQL Docs
When a network error occurs, Apollo Client adds it to the error.networkError field returned by your useQuery call (or whichever operation hook you...
Read more >
Common Errors When Using MySQL - O'Reilly
To remedy the problem, first check that your query is correct. Is it reasonable that it should return so many rows? If so,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found