-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Report: add more robust handling of default property values stripped by LHR proto #12868
Comments
Thanks for the report, we're looking into it now. In the future, to save yourself extra effort when reporting bugs, what is most important (and is usually sufficient) is the stack trace of the error, which I was able to find in your video. Sharing here for others: Repro: https://googlechrome.github.io/lighthouse/viewer/?psiurl=https://www.investmentu.com |
"entity": {
"type": "link",
"text": "PushCrew"
} Looks good, right? Except remember: empty strings are dropped in LR because of proto shenanigans. https://github.com/GoogleChrome/lighthouse/blob/3ff45bb/core/lib/proto-preprocessor.js#L76 We should add a check in safelySetHref that the url is |
Reason why empty strings get dropped (not documented in our code so I asked shane): proto json encoder/decoder, by default, does not include fields if the value is the default for that type. This can be configured, but not on a per-type basis, so we must keep that option off. The issue is not "extra bloat"; but that not-present and the default value has different semantics in JS* (can someone confirm this?). (I want to get a proper explanation so it can be added as a comment in
Alternatively: should we replace empty strings in LR with something like |
thank you, dude! I open a PR that works for me: #12869 It just prevents maybe it can help |
@derevandal thanks for the PR! Agree that'll definitely fix it. We will probably reach a bit deeper to try to fix the root issue, but we definitely appreciate you drafting that. @connorjclark @brendankenny fixing the root issue feels like.. we address any of these situations. I think that's anything inside a proto |
Yeah, it's definitely a bummer. Error handling actually came up in the original review for
Converting all Maaaybe there's something in jspb in the years since we got this working where we have some wiggle room to make this better? |
we could do this (we do it automatically to strip out |
for testing: We could expand |
sample json doesn't include this particular case, and if there are others they are likely behind conditionals/fallbacks that we may not know to trigger. So it isn't full-proof, but it's still a good idea.
I'll double-check if we really can't disable the default-exclusion behavior for only strings. |
I guess it may not work for auditDetails in particular, since we have a lot of optional properties. I assume the JSON serializer won't be able to tell the difference between an optional string and a required empty string, since both will come as 0 bytes over the wire, so it needs to treat them both as |
No immediate plans to fix root cause. We would like to:
|
FAQ
URL
https://investmentu.com
What happened?
I've set up an LHCI server with PSI auto collect.
But I'm getting one tiny issue related to
https://googlechrome.github.io/lighthouse/viewer/
.When I click to open any report, the view complains:
Debugging it, I "solved" this issue by setting the second parameter of this function to an empty string as default.
2021-08-05-10-39-05.mp4
2021-08-05-10-24-41.mp4
What did you expect?
The report should be shown properly.
What have you tried?
I've used local overwrites to debug and found the solution.
How were you running Lighthouse?
PageSpeed Insights
Lighthouse Version
8.0.0
Chrome Version
No response
Node Version
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: