GoogleChrome / lighthouse

Automated auditing, performance metrics, and best practices for the web.
https://developer.chrome.com/docs/lighthouse/overview/
Apache License 2.0
28.38k stars 9.38k forks source link

errors-in-console audit can produce extremely large JSON reports #13817

Open wildlyinaccurate opened 2 years ago

wildlyinaccurate commented 2 years ago

FAQ

URL

https://www.gucci.com/us/en/cart

What happened?

On pages that produce errors with a large call stack, the errors-in-console audit can inflate the Lighthouse JSON report size - this example URL should generate a report between 150-250 MB in size. This is due to the stack trace of one particular error being over 1.5 MB.

What did you expect?

I didn't expect the report size to be inflated so much by console errors. Perhaps the stack trace should be truncated, or duplicate errors could be ignored.

What have you tried?

No response

How were you running Lighthouse?

CLI

Lighthouse Version

9.5.0

Chrome Version

100.0.4896.75

Node Version

17.5.0

OS

Ubuntu 21.10 on Linux 5.13

Relevant log output

No response

adamraine commented 2 years ago

Yeah I think we can truncate the message descriptions.

connorjclark commented 2 years ago

We should truncate descriptions if they start with "RangeError: Maximum call stack size exceeded", otherwise I think we should always keep the full description.

image
connorjclark commented 2 years ago

But in a way that keeps intact the top N frames of the callstack.

adamraine commented 2 years ago

Maybe we could truncate based on \n characters. Like include up to the first 10 \n.

connorjclark commented 2 years ago

Just to nerd snipe myself, here's how new lines can show up in weird places

image image

here's a regex that matches v8's stack frames https://github.com/stacktracejs/stacktrace.js/blob/c12fccdbf21b8ecf215b35474070da1b1c23206d/dist/stacktrace-with-promises-and-json-polyfills.js#L18