Closed gzhhong closed 1 year ago
This is expected. Next.js middleware are supposed to run in the Vercel Edge network, i.e. Cloudflare workers. This environment is not Node.js. Therefore you are running the browser build of Pino.
@mcollina , Hello mcollina, thank you for the answer. My nextjs application is deployed on my private cloud. It is containerized in docker (based on an image alpine-node-chromium) and running in openshift. At beginning I think nextjs will use the Node to run its server side logic, like the getServerSideProps. And all of the other components running in browser, but I never deeply think where the middleware will run in this case. Can you give me more detail about how the next.js will run its different components?
You should be asking them ;).
My understanding is that the middlewares are bundled like it's a browser and not Node.js, and therefore the logs are different (unfortunately, there are too many limitations in the browser).
OK, thanks for the help.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hello,
I use pino (v8.8.0) in my nextjs (v13.0.4) project.
in the project_home/utils/Logger.js, I created the logger very simple:
in project_home/utils/SitemapUtils.js, I used the logger by:
The format of the logs printed here is:
So everything works fine.
In the project_home/middleware.js, I use the logger as:
But the format of the logs looks like:
Can anyone help me on this issue?
Thanks,
James