Skip to content
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

Don't convert error to string #36804

Merged
merged 4 commits into from May 11, 2022
Merged

Don't convert error to string #36804

merged 4 commits into from May 11, 2022

Conversation

hanneslund
Copy link
Contributor

Stack trace disappears when error is converted to string.
I changed the types in log.ts to match console.log/console.error/console.warn.

fixes #31591

@ijjk
Copy link
Member

ijjk commented May 10, 2022

Stats from current PR

Default Build (Decrease detected ✓)
General Overall decrease ✓
vercel/next.js canary hanneslund/next.js issue-31591 Change
buildDuration 18s 18.4s ⚠️ +381ms
buildDurationCached 7.1s 7.1s -8ms
nodeModulesSize 475 MB 475 MB -143 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary hanneslund/next.js issue-31591 Change
/ failed reqs 0 0
/ total time (seconds) 4.483 4.543 ⚠️ +0.06
/ avg req/sec 557.6 550.33 ⚠️ -7.27
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.564 1.584 ⚠️ +0.02
/error-in-render avg req/sec 1598.73 1578.46 ⚠️ -20.27
Client Bundles (main, webpack)
vercel/next.js canary hanneslund/next.js issue-31591 Change
925.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 28.8 kB 28.8 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 72.5 kB 72.5 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary hanneslund/next.js issue-31591 Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary hanneslund/next.js issue-31591 Change
_app-HASH.js gzip 1.36 kB 1.36 kB
_error-HASH.js gzip 193 B 193 B
amp-HASH.js gzip 308 B 308 B
css-HASH.js gzip 327 B 327 B
dynamic-HASH.js gzip 2.69 kB 2.69 kB
head-HASH.js gzip 359 B 359 B
hooks-HASH.js gzip 920 B 920 B
image-HASH.js gzip 5.7 kB 5.7 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 2.64 kB 2.64 kB
routerDirect..HASH.js gzip 320 B 320 B
script-HASH.js gzip 391 B 391 B
withRouter-HASH.js gzip 318 B 318 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 15.9 kB 15.9 kB
Client Build Manifests
vercel/next.js canary hanneslund/next.js issue-31591 Change
_buildManifest.js gzip 459 B 459 B
Overall change 459 B 459 B
Rendered Page Sizes
vercel/next.js canary hanneslund/next.js issue-31591 Change
index.html gzip 532 B 532 B
link.html gzip 545 B 545 B
withRouter.html gzip 527 B 527 B
Overall change 1.6 kB 1.6 kB

Default Build with SWC (Increase detected ⚠️)
General Overall decrease ✓
vercel/next.js canary hanneslund/next.js issue-31591 Change
buildDuration 19.9s 19.4s -502ms
buildDurationCached 7.1s 6.9s -139ms
nodeModulesSize 475 MB 475 MB -143 B
Page Load Tests Overall increase ✓
vercel/next.js canary hanneslund/next.js issue-31591 Change
/ failed reqs 0 0
/ total time (seconds) 4.548 4.453 -0.09
/ avg req/sec 549.71 561.38 +11.67
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.591 1.453 -0.14
/error-in-render avg req/sec 1571.59 1720.47 +148.88
Client Bundles (main, webpack)
vercel/next.js canary hanneslund/next.js issue-31591 Change
925.HASH.js gzip 178 B 178 B
framework-HASH.js gzip 42.2 kB 42.2 kB
main-HASH.js gzip 29.2 kB 29.2 kB
webpack-HASH.js gzip 1.45 kB 1.45 kB
Overall change 73.1 kB 73.1 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary hanneslund/next.js issue-31591 Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary hanneslund/next.js issue-31591 Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 179 B 179 B
amp-HASH.js gzip 312 B 312 B
css-HASH.js gzip 324 B 324 B
dynamic-HASH.js gzip 2.71 kB 2.71 kB
head-HASH.js gzip 357 B 357 B
hooks-HASH.js gzip 921 B 921 B
image-HASH.js gzip 5.79 kB 5.79 kB
index-HASH.js gzip 261 B 261 B
link-HASH.js gzip 2.76 kB 2.76 kB
routerDirect..HASH.js gzip 322 B 322 B
script-HASH.js gzip 392 B 392 B
withRouter-HASH.js gzip 317 B 317 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 16.1 kB 16.1 kB
Client Build Manifests
vercel/next.js canary hanneslund/next.js issue-31591 Change
_buildManifest.js gzip 456 B 456 B
Overall change 456 B 456 B
Rendered Page Sizes
vercel/next.js canary hanneslund/next.js issue-31591 Change
index.html gzip 530 B 530 B
link.html gzip 544 B 544 B
withRouter.html gzip 527 B 527 B
Overall change 1.6 kB 1.6 kB
Commit: 01e6444

Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, are we able to add a regression test for this?

@@ -693,7 +693,7 @@ export default class DevServer extends Server {
) {
let usedOriginalStack = false

if (isError(err) && err.name && err.stack && err.message) {
if (isError(err) && err.stack) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isError already checks if name and message are there, is the second truthiness check necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to drop the redundant checks here 👍

@hanneslund hanneslund requested a review from ijjk May 11, 2022 13:09
Copy link
Member

@ijjk ijjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes and added tests look good, thanks!

@kodiakhq kodiakhq bot merged commit 2e13534 into vercel:canary May 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2022
@hanneslund hanneslund deleted the issue-31591 branch September 8, 2022 06:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Next.js don't show stack trace for unhandled rejection errors
2 participants