[BUG] Missing stack trace of thrown error in log produced by nestjs built-in error handler
See original GitHub issue[x] I’ve read the docs of nestjs-pino
[x] I’ve read the docs of pino
[x] I couldn’t find the same open issue of nestjs-pino
There is an open issue https://github.com/iamolegga/nestjs-pino/issues/535, but that issue focuses on express
, but I am not convinced my issue is related to express
.
What is the current behavior?
nestjs-pino@2.3.0
is missing stack traces
What is the expected behavior?
Stack traces should be included in error logs, just like previously in nestjs-pino@1.4.0
Please provide minimal example repo. Without it this issue will be closed I created two NestJS applications, older one includes stack traces in error logs, newer version does not.
See examples here: https://github.com/raidokaldma/nestjs-pino-issue
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[FEATURE REQUEST] Correct stack trace in `request errored ...
A small update, stack should be fixed in the latest release for logs produced by nestjs built-in error handlers (more on this here...
Read more >Best Practices for Node.js Error-handling - Toptal
This article will introduce you to error-handling in Node.js and demonstrate some of the best ... That is a bug a developer made,...
Read more >Re-throwing exception in NodeJS and not losing stack trace
The problem with creating a new Error is you can lose metadata that was attached to the original Error that was thrown, the...
Read more >Uncaught errors in Node.js and the browser
This article looks into what happens with unhandled errors both in Node.js and in the browser.
Read more >Node.js Error Handling Best Practices - Sematext
It has an error.stack field that gives you a stack trace showing where the error came from. It also lists all functions that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
shipped in v2.3.1
Finally found the bug. Working on fixing it.
In short, there is a difference between nestjs built-in
LoggerService
interface in v7 and v8. v7’serror
method hasstack
argument, but in v8 it’s dropped for consistency between all the other methods. But in many places of the nestjs sources it’s still called like in v7, so this becomes a headache for lib owners to detect ifoptionalParams
contains stack to properly set such field when logging error 😅This issue differs from #535 because here the reason is a difference between logger versions and the logger call in exception handlers, and #535 is about
request completed/errored
pino-http
’s log