Closed u1x30 closed 1 year ago
Mind adding Pino to experimental.serverComponentsExternalPackages
to see if it helps?
Context: https://nextjs.org/docs/app/api-reference/next-config-js/serverComponentsExternalPackages
If this does not help, please open a new issue with a linked reproduction, so we can investigate. The example you linked to uses pages
but you are mentioning that it does not work in the App Router, so it's not an actual reproduction.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
Do not have replay bug
To Reproduce
Make a PINO logger call from any app/api endpoint.
Describe the Bug
Nextjs13 app/api endpoints error when using the pino logger:
node:internal/event_target:1037 process.nextTick(() => { throw err; }); ^ Waiting for the debugger to disconnect... Error: Cannot find module '/ui/.next/server/app/api/order/lib/worker.js'
error node_modules/thread-stream/index.js (229:18) @ ThreadStream.write error uncaughtException: Error: the worker has exited at ThreadStream.write (webpack-internal:///(sc_server)/./node_modules/thread-stream/index.js:193:25) at Pino.write (webpack-internal:///(sc_server)/./node_modules/pino/lib/proto.js:162:12) at Pino.LOG [as debug] (webpack-internal:///(sc_server)/./node_modules/pino/lib/tools.js:47:27 Endpoint does not call logger directly and calls service that uses the pino logger.
Pino works fine with page/api endpoints.
NextJS recommends Pino:
https://nextjs.org/docs/pages/building-your-application/deploying/production-checklist#logging
https://vercel.com/templates/next.js/pino-logging
PINO logger works fine with pages/api endpoints which is reason why did not upgrade endpoints to the app/api directory.
Are any plans for Pino app/api support or work arounds to get it working? Should we abandon the recommendation and go with other logger for NextJS 13 app/api?
This issue is preventing us from upgrading our API enpoints to the app/api. At very least, please provide us details on what logger is supported.
Expected Behavior
Pino logs statement without error.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response