GoogleChrome / lighthouse-ci

Automate running Lighthouse for every commit, viewing the changes, and preventing regressions
Apache License 2.0
6.34k stars 635 forks source link

Lighthouse Server UI starts to break when URL is not accessed from root URL #893

Closed Taewan-P closed 1 year ago

Taewan-P commented 1 year ago

Describe the bug A clear and concise description of what the bug is. Lighthouse Server UI starts to break when URL is not accessed from root URL.

To Reproduce Steps to reproduce the behavior:

  1. Access custom server
  2. Browse a little
  3. Access to a direct url ex) https:///app/projects//compare/4a4f6dd4-4d67-4672-a93a-dd14a73b0604
  4. From the site accessed from step 3, all html should break wherever you click or go.

Expected behavior A clear and concise description of what you expected to happen.

UI should not break at all circumstances

Logs/Screenshots If applicable, add LHCI logs or screenshots to help explain your problem.

image image

However, when accessing to other pages after the ui is broken, there is a browser console error like this:

image

Server log shows all 200 in resources

Environment (please complete the following information):

Additional context Add any other context about the problem here.

Taewan-P commented 1 year ago
Taewan-P commented 1 year ago

I don't know if this is related to the issue, but I use postgres for the db server.

sandrodesouza commented 1 year ago

Here is the diff that solved my problem:

diff --git a/node_modules/@lhci/server/dist/index.html b/node_modules/@lhci/server/dist/index.html
index 960e15e..6bffd00 100644
--- a/node_modules/@lhci/server/dist/index.html
+++ b/node_modules/@lhci/server/dist/index.html
@@ -21,7 +21,7 @@
                 l.href = url;
                 document.head.appendChild(l);
             }
-            loadStyle('chunks/entry-WKRDB3RZ.css');
+            loadStyle('/app/chunks/entry-WKRDB3RZ.css');
         }());
     </script>
 </head>
Taewan-P commented 1 year ago

Thank you for the information! 👍

paulirish commented 1 year ago

This is fixed in https://github.com/GoogleChrome/lighthouse-ci/pull/879 Which was released in lhci v0.11.1 A matching new release of the patrickhulce/lhci-server docker image also shipped yesterday.

And FYI we have a new release of lhci coming which bumps the LH version used to 10.x. You can watch #891 for updates on that.