Open jdoe802 opened 1 month ago
EDIT:
Cannot read properties of null (reading 'fn')
.Posting here as well, in case it helps others in the future:
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).
Minimally reproduceable code (nextjs app)
next.config.js
prettyLogger.ts
package.json
this code works with the webpack portion commented out, but I want it to work with the webpack portion. After leaving in the webpack portion I get the following error
TypeError: Cannot read properties of null (reading 'fn') at...\node_modules\next\dist\compiled\webpack\bundle5.js:13:29685 at Array.map ()
at AsyncSeriesHookCodeFactory.setup (...\node_modules\next\dist\compiled\webpack\bundle5.js:13:29675)
at Hook.COMPILE [as compile] (...\node_modules\next\dist\compiled\webpack\bundle5.js:13:24094)
at Hook._createCall (...\node_modules\next\dist\compiled\webpack\bundle5.js:13:26635)
at Hook.CALL_ASYNC_DELEGATE (...\node_modules\next\dist\compiled\webpack\bundle5.js:13:25988)
at run (...\node_modules\next\dist\compiled\webpack\bundle5.js:28:140498)
at Compiler.run (...\node_modules\next\dist\compiled\webpack\bundle5.js:28:140794)
at ...\node_modules\pino-webpack-plugin\src\index.js:134:23
at ...\node_modules\next\dist\compiled\webpack\bundle5.js:28:70677