Skip to content

@logtail/pino in nextjs  #106

@TranHung92

Description

@TranHung92

When I follow this setup

const token = '$SOURCE_TOKEN'; 
const pino = require('pino');
const transport = pino.transport({
  target: "@logtail/pino",
  options: { sourceToken: token }
});
const logger = pino(transport);

I get the error below nonstop and the server crashes

⨯ node_modules/thread-stream/index.js (235:18) @ ThreadStream.write
 ⨯ uncaughtException: Error: the worker has exited
    at ThreadStream.write (webpack-internal:///(rsc)/./node_modules/thread-stream/index.js:199:25)
    at Pino.write (webpack-internal:///(rsc)/./node_modules/pino/lib/proto.js:163:12)
    at Pino.LOG (webpack-internal:///(rsc)/./node_modules/pino/lib/tools.js:39:27)
    at Pino.eval [as fatal] (webpack-internal:///(rsc)/./node_modules/pino/lib/levels.js:17:22)
    at process.eval (webpack-internal:///(rsc)/./src/logging.ts:53:16)
    at process.emit (node:events:529:35)
    at process._fatalException (node:internal/process/execution:158:25)
null
Error: the worker has exited
    at ThreadStream.write (webpack-internal:///(rsc)/./node_modules/thread-stream/index.js:199:25)
    at Pino.write (webpack-internal:///(rsc)/./node_modules/pino/lib/proto.js:163:12)
    at Pino.LOG (webpack-internal:///(rsc)/./node_modules/pino/lib/tools.js:39:27)
    at Pino.eval [as fatal] (webpack-internal:///(rsc)/./node_modules/pino/lib/levels.js:17:22)
    at process.eval (webpack-internal:///(rsc)/./src/logging.ts:53:16)
    at process.emit (node:events:529:35)
    at process._fatalException (node:internal/process/execution:158:25)

What would be the best way to stream pino logs to logtail?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions