next.js
next.js copied to clipboard
Vercel Logging Broken on app router
Link to the code that reproduces this issue
https://github.com/iFixit/react-commerce/pull/2221
To Reproduce
Migrating a route from the pages router to the app router seems to break the way Vercel parses / interprets console.log()
logging output.
Current vs. Expected behavior
Expected Behavior: all log lines for a request are grouped under one request. This is what we see for the pages router:
Current Behavior: After migrating a route to use the app router, all log lines are treated as individual and separate requests. This breaks all logging integrations and makes logs rather useless.
Provide environment information
Next: 13.4.12 deployed on vercel
Which area(s) are affected? (Select all that apply)
App Router
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
I'm not sure if the fault lies with next.js, vercel, or some error in their integration.
Minimal reproducible example as outlined by Vercel: https://github.com/iFixit/vercel-app-router-logging-example
Can we get an update on this? This is forcing us to move to a different logging provider.
@realshovanshah, We were told by Vercel's support that the splitting of logs into separate lines is expected with the app router.
The main feature that causes the lines to be split is deep in the core of Next. If I remember correctly, each async function is treated as a unique process. This means the logs are no longer tied to a single process and grouped.
We were advised that if we wanted the logs grouped, we should implement our logic / wrap the logs in a logging provider.