Closed mikerockett closed 1 year ago
0.7.0
Darwin 22.5.0 arm64 arm
When using Pino, I am unable to use transports – specifically, pino/file, which spawns a Worker as opposed to using the main thread.
pino/file
bun add pino
logger.ts
import pino from 'pino' import * as path from 'path' const transportConfig = pino.transport({ targets: [ { level: process.env.NODE_ENV === 'production' ? 'info' : 'debug', target: 'pino/file', options: { destination: path.resolve(__dirname, '../logs/main.log'), mkdir: true } } ] }) export const logger = pino(transportConfig) transportConfig.on('ready', () => process.exit(0))
entrypoint.ts
logger.info('here')
I expect Pino to be able to create a Worker in order for the pino/file target to function.
Error thrown:
47 | const { filename, workerData } = opts 48 | 49 | const bundlerOverrides = '__bundlerPathsOverrides' in globalThis ? globalThis.__bundlerPathsOverrides : {} 50 | const toExecute = bundlerOverrides['thread-stream-worker'] || join(__dirname, 'lib', 'worker.js') 51 | 52 | const worker = new Worker(toExecute, { ^ TypeError: undefined is not a constructor (evaluating 'new Worker') at createWorker (/<path>/node_modules/thread-stream/index.js:52:17) at new ThreadStream (/<path>/node_modules/thread-stream/index.js:224:18) at buildStream (/<path>/node_modules/pino/lib/transport.js:21:17) at transport (/<path>/node_modules/pino/lib/transport.js:114:9) at /<path>/lib/logger.ts:5:24
I'm not sure if this is something Pino needs to fix, however it appears to be trivial and related to Bun still being in the oven…
Duplicate of https://github.com/oven-sh/bun/issues/901
What version of Bun is running?
0.7.0
What platform is your computer?
Darwin 22.5.0 arm64 arm
What steps can reproduce the bug?
When using Pino, I am unable to use transports – specifically,
pino/file
, which spawns a Worker as opposed to using the main thread.bun add pino
logger.ts
and populate with the below:entrypoint.ts
(logger.info('here')
).What is the expected behavior?
I expect Pino to be able to create a Worker in order for the
pino/file
target to function.What do you see instead?
Error thrown:
Additional information
I'm not sure if this is something Pino needs to fix, however it appears to be trivial and related to Bun still being in the oven…