pinojs / pino-pretty

🌲Basic prettifier for Pino log lines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pino-pretty fails to load via Bun

denis-guesty opened this issue · comments

There is an issue with this package when running it via Bun, below is the stack trace.

124 |       return join(__dirname, '..', 'file.js')
125 |     }
126 |
127 |     let fixTarget
128 |
129 |     for (const filePath of callers) {
                               ^
TypeError: undefined is not an object (evaluating 'callers')
      at fixTarget (/Users/***/Workspace/bun-test/node_modules/pino/lib/transport.js:129:27)
      at transport (/Users//***/Workspace/bun-test/node_modules/pino/lib/transport.js:114:21)
      at normalizeArgs (/Users//***/Workspace/bun-test/node_modules/pino/lib/tools.js:311:15)
      at pino (/Users//***/Workspace/bun-test/node_modules/pino/pino.js:87:27)
      at /Users//***/Workspace/bun-test/server.ts:7:16
124 |       return join(__dirname, '..', 'file.js')
125 |     }
126 |
127 |     let fixTarget
128 |
129 |     for (const filePath of callers) {
                               ^
TypeError: undefined is not an object (evaluating 'callers')
      at fixTarget (/Users//***/Workspace/bun-test/node_modules/pino/lib/transport.js:129:27)
      at transport (/Users//***/Workspace/bun-test/node_modules/pino/lib/transport.js:114:21)
      at normalizeArgs (/Users//***/Workspace/bun-test/node_modules/pino/lib/tools.js:311:15)
      at pino (/Users//***/Workspace/bun-test/node_modules/pino/pino.js:87:27)
      at /Users//***/Workspace/bun-test/server.ts:7:16
      

Reproduction code:

Create a new bun app, add pino and pino-pretty run the following snippet.

import logger from 'pino';

const logging = logger({
  transport: {
    target: 'pino-pretty',
  },
});

logging.info('hello world');

Thanks for reporting. We do not have the resources to support Bun users. Please refer to the Bun Discord or Issue Tracker for such questions.

I did a hackfix on my fork here: capaj/pino@8fb80fb

Tests are passing:
image

not sure if it is worth opening a PR.
@mcollina would you accept that hackfix into master?

That's not on my plan. I'm not supporting a runtime that I cannot guarantee via unit tests. When/if I can run the same tests on both... then I'd be more than happy to support them officially.

Fair, thanks for the quick answer. I suspect Bun will be able to fix the Callsite problem quite fast on their side, but if they cannot I might open it for a PR with adding a bun test worklow into https://github.com/pinojs/pino-pretty/blob/master/.github/workflows/ci.yml

At this point in time, Bun does not run node-tap