-
Notifications
You must be signed in to change notification settings - Fork 878
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
Endless issues of Error: Cannot find module '....\.next\server\vendor-chunks\lib\worker.js' #2028
Comments
The below did not work in production and I had to go back to a logger based on console.log. 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: vercel/next.js#46987 (comment) Hope it helps (the key to the worker issue you are getting was the webpack part). |
I had a similar issue getting Next.js to work with Pino and was able to get it to work by setting the serverComponentsExternalPackages prop in the next.config.js file. I'm using pino-pretty for local development and a custom transport developed using "pino-abstract-transport".
|
Excluding pino from the build does not solve the problem of using pino in middleware, server actions, and route handlers. Perhaps it would be possible to use just in normal server components, but not on the edge. |
Please reach out to the Next.js maintainers. |
I ran into similar but not exactly the same issue
After significant digging, I realized that server-side logger, So, I had to create two separate loggers - one using Later to make life easier, I just shifted to using Hope this info can help anyone else that falls into the trap and save hours of investigations. |
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.
The text was updated successfully, but these errors were encountered: