You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure where to open this issue. Ultimately it more likely belongs to either the source-map-support repo or the tsx repo. But I wonder if source-map-support needs to be a requirement at all.
Issue at hand:
When using tsx in conjunction with pino and pino-caller, the line numbers in the stack traces are getting messed up.
$ npx tsx index.ts | npx pino-pretty -S
[12:40:21.134] ERROR (66060) <file:///data/user/Downloads/demo/index.ts:1:101>: error
err: {
"type": "Error",
"message": "artrifical error",
"stack":
Error: artrifical error
at file:///data/user/Downloads/demo/index.ts:1:112
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
}
This is ultimately caused by the require('source-map-support/register') line in pino-caller. More specifically, it seems to be caused by the Error.prepareStackTrace override that happens inside source-map-support. I didn't dig any deeper than that. But I was wondering whether pino-caller needs this line of code in the first place:
Node v12 was released 5 years ago and its extended support ran out over 2 years ago. Given all of that, I would argue that removing source-map-support package is an easy fix and it is no longer needed for any sane use-case.
The text was updated successfully, but these errors were encountered:
I am not sure where to open this issue. Ultimately it more likely belongs to either the
source-map-support
repo or thetsx
repo. But I wonder ifsource-map-support
needs to be a requirement at all.Issue at hand:
When using
tsx
in conjunction withpino
andpino-caller
, the line numbers in the stack traces are getting messed up.It is best demonstrated with a minimal example:
Working scenario (without pino-caller)
index.ts
Output (correctly reports
index.ts:5:18
)Defect scenario (with pino-caller)
index.ts
Output (incorrectly reports
index.ts:1:112
)This is ultimately caused by the
require('source-map-support/register')
line in pino-caller. More specifically, it seems to be caused by theError.prepareStackTrace
override that happens insidesource-map-support
. I didn't dig any deeper than that. But I was wondering whether pino-caller needs this line of code in the first place:Quote from their README.md:
Node v12 was released 5 years ago and its extended support ran out over 2 years ago. Given all of that, I would argue that removing
source-map-support
package is an easy fix and it is no longer needed for any sane use-case.The text was updated successfully, but these errors were encountered: