-
-
Notifications
You must be signed in to change notification settings - Fork 770
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
[BUG]: Postgres.JS errors don't show app stack trace #1827
Comments
Hi, @Hansenq. It appears that the issue you're encountering is related to the differences in how database drivers, specifically Postgres.js and node-postgres (pg), handle and report errors. Each driver has its own error handling mechanism that can affect the stack trace and the level of detail provided in error messages. So, this is not related to Drizzle ORM. |
Ah, makes sense. Is there a way inside drizzle to intercept database adapter errors and print out/add more information? Otherwise, this is pretty nasty error that makes it much more difficult to debug, and it might be good to recommend node-postgres over postgres.js for drizzle users in the documentation, just because of this error handling. |
Yeah, we have a ticket for proper error handling and wrapping drivers errors with our own. You can track it here: #376 I'll close this issue then. Thanks for your report! |
I've created a patch file to apply the above PR and enable stack traces for postgres.js https://gist.github.com/fnimick/acc597c555e5801e9a4bac36c8ba5e9a |
What version of
drizzle-orm
are you using?0.29.3
What version of
drizzle-kit
are you using?0.20.13
Describe the Bug
I connect to my database with Postgres.js. When I execute a query through drizzle, and I hit an error in my database (such as a column not found, etc.), I expect a stack trace to let me know which line of my code caused the error. This is an error with drizzle's use of Postgres.js, since the error doesn't happen with node-postgres.
The stack trace that appears contains a stack trace of where the error hit inside the Postgres.js adapter, but it doesn't show where the error occurred in drizzle or in my code:
This makes it extremely difficult to debug where the error happened, since I have no idea where the error was hit.
Expected behavior
When I switch to node-postgres, I the error is what I expect: a stack trace for my app-level code:
Environment & setup
No response
The text was updated successfully, but these errors were encountered: