pinojs/pino

--frozen-intrinsics: Cannot assign to read only property 'prepareStackTrace' of function 'function Error() { [native code] }'

Open

#2 071 ouverte le 28 oct. 2024

Voir sur GitHub
 (8 commentaires) (0 réactions) (0 assignés)JavaScript (13 157 stars) (839 forks)batch import
enhancementgood first issue

Description

When the NodeJS process runs with --frozen-intrinsics, creating a pino logger throws an error.

> node --env-file ./.env --enable-source-maps --disable-proto=throw --disallow-code-generation-from-strings --frozen-intrinsics ./build/main.js

(node:1764737) ExperimentalWarning: Frozen intristics is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
<cwd>/node_modules/.pnpm/pino@9.5.0/node_modules/pino/lib/caller.js:9
  Error.prepareStackTrace = noOpPrepareStackTrace
                          ^

TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot assign to read only property 'prepareStackTrace' of function 'function Error() { [native code] }'
    at getCallers (<cwd>/node_modules/.pnpm/pino@9.5.0/node_modules/pino/lib/caller.js:9:27)
    at pino (<cwd>/node_modules/.pnpm/pino@9.5.0/node_modules/pino/pino.js:90:48)
    at server (<cwd>/src/commands/server.ts:8:17)
    at main (<cwd>/src/main.ts:58:8)
    at <anonymous> (<cwd>/src/main.ts:63:26)
    at ModuleJob.run (node:internal/modules/esm/module_job:268:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)

Node.js v23.1.0
ELIFECYCLE Command failed with exit code 1.
[nodemon] app crashed - waiting for file changes before starting...

Due to this line

https://github.com/pinojs/pino/blob/231adffeccd71f26627a43260c09bfb61a98fcaa/lib/caller.js#L9

Guide contributeur