-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
fix(core): better error logging on SSR/dev failures + log stacktraces and error causes #8872
Conversation
// TODO this logger thing is annoying | ||
// This makes it impossible to use native logging of nested stacktraces | ||
// ie the error causes are not logged here | ||
// It seems we can't have colors + nested stacktrace logging at the same time | ||
logger.error(err instanceof Error ? err.stack : err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Josh-Cena this thing is a bit annoying because if an error is thrown with a cause it won't print the cause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we can use the built-in error logging? This code has been there forever, and I think it's fine at this point to remove it and just use console.log(err)
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
Size Change: +306 B (0%) Total Size: 1.01 MB
ℹ️ View Unchanged
|
Let's give it a try. Not sure I'll backport this, looks a bit risky although I'd be happy to have better error logging in the v2.x releases. We'll see if it works great first |
Motivation
Currently when a React component fails to render, we have bad error messages related to chalk (see #8826 (comment)):
For some reason when using chalk inside the Webpack
serverEntry.tsx
we have issues (looks related to unability to resolve properly "ansi-styles" package). I was not able to fix this issue so simply removed the usage of chalk inserverEntry.tsx
I also did some cleanup in the way we output Webpack stats errors/warnings in start/build.
Test Plan
CI and local tests in both dev/prod mode
DOCUSAURUS_CRASH_TEST=true yarn build:website:fast
Some additional notes.