1

So I'm trying to programmatically conduct Google Lighthouse audits on several webpages, and I'm running into an issue. After installing Chrome and node/npm/lighthouse on an Amazon Linux 2 EC2 instance, I am able to successfully run LightHouse tests when I initiate a GUI session and run a command from a terminal within the GUI (this launches chrome and conducts the test as usual) but I am unable to do the same thing from the command line. This is the error I get when launching lighthouse. ChromeLauncher:error [42565:42565:0516/170626.787500:ERROR:brower_main_loop.cc (1386) Unable to open X display.

While there are a couple of other errors, I believe this is the one I should be paying attention to, because when I try to just launch Google Chrome, that is the exact error I get, so I am inclined to believe it is an issue with trying to launch on a display.

I've also tried the "--headless" option when launching chrome and get [0516/171128.450564:WARNING:headless_browser_main_parts.cc(83)] Cannot create Pref Service with no user data dir. [0516/171128.521499:ERROR:vaapi_wrapper.cc(594)] Could not get a valid VA display [0516/171128.524992:ERROR:gpu_init.cc(426)] Passthrough is not supported, GL is egl

Another user with a similar question decided to use the Google Pagespeeds API, which will not a be a solution for me-- it needs to be done locally.

Because this works fine on a GUI session with the same server, I really think it's just a display rendering issue, but I don't know how to solve this. Maybe "simulating" a display? I've also tried entering export DISPLAY=1:0, which apparently worked for some users and caused me to stop seeing the error, but the functionality was still broken when running the audit.

Any help would be so useful!!

oost
  • 11
  • 1

1 Answers1

0

Information found in this stackoverflow question was infinitely helpful. Although I still get a slew of errors when I try to launch the browser, I can successfully run LightHouse and audit the pages I want to without any errors.

oost
  • 11
  • 1