Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@logtail/pino in nextjs #106

Open
TranHung92 opened this issue Feb 21, 2024 · 3 comments
Open

@logtail/pino in nextjs #106

TranHung92 opened this issue Feb 21, 2024 · 3 comments

Comments

@TranHung92
Copy link

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?

@curusarn
Copy link
Contributor

Hi @TranHung92,

Thank you for reaching out! I hope you're doing great!

Could you share more details about your setup? 🙏
What NextJS version are you using?
Are you using the latest @logtail/pino version?

Thanks again for raising this!

@TranHung92
Copy link
Author

Hi @curusarn
I'm using nextjs 14.1.0 with app router setup and @logtail/pino@0.4.19

@TranHung92
Copy link
Author

@curusarn any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants