Open jdoe802 opened 3 months ago
I spent two days around the same issue, and subsequent ones.
After a lot of trial-and-error I figured out how to make pino work in a Next.js monorepo (Turborepo), with transports, pino-pretty, and functions for messageFormat, customPrettifier, and so on (i.e. non-streamable types).
Here is the setup, with explanations: https://github.com/vercel/next.js/discussions/46987#discussioncomment-10397449
Hope it helps (the key to the worker issue you are getting was the webpack part).
Link to the code that reproduces this issue
https://github.com/jdoe802/pino-pretty-mongo-minimal
To Reproduce
have been working on this for a few weeks now. I was getting errors like the following when trying to implement pino transport
this originally seemed to be fixed with the following workaround being added to the next.config file: (the worker.js file, indexes file, and wait file were all copied from /node_modules/thread-stream/ folder)
however after further inspection some logs were outputting correctly with pino transport and others were causing this message
The logging transport that is triggering all these issues:
I've tried multiple solutions (commented out in the repo) Overall it is logging in some places but not in others in my full code repo. It logs to console in all files when I don't add the transport streams. After adding the transport streams and multiple workarounds, getting this. If next could just update their files so that worker.js was properly found in the first place many issues would be avoided.
Current vs. Expected behavior
I expected the logging to work without throwing worker.js related issues
Provide environment information
Which area(s) are affected? (Select all that apply)
Output (export/standalone), Webpack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
This issue is happening locally .