@@ -27,6 +27,25 @@ export const runLighthouse = async (url, settings) => {
27
27
// Launch Chrome using puppeteer
28
28
try {
29
29
console . log ( 'Launching Chrome with puppeteer...' ) ;
30
+ console . log ( 'Puppeteer package:' , JSON . stringify ( {
31
+ version : puppeteer . version ,
32
+ browserRevision : puppeteer . _preferredRevision
33
+ } ) ) ;
34
+
35
+ try {
36
+ console . log ( 'Default browser path:' , await puppeteer . executablePath ( ) ) ;
37
+ } catch ( err ) {
38
+ console . log ( 'Error getting default browser path:' , err . message ) ;
39
+ }
40
+
41
+ try {
42
+ const browserFetcher = puppeteer . createBrowserFetcher ( ) ;
43
+ const revisionInfo = await browserFetcher . download ( ) ;
44
+ console . log ( 'Browser download info:' , revisionInfo ) ;
45
+ } catch ( err ) {
46
+ console . log ( 'Error downloading browser:' , err . message ) ;
47
+ }
48
+
30
49
// Check for Chrome in Netlify environment first
31
50
const chromePaths = [
32
51
'/opt/buildhome/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome' ,
@@ -82,17 +101,35 @@ export const runLighthouse = async (url, settings) => {
82
101
} ;
83
102
84
103
console . log ( 'Launching browser with config:' , launchConfig ) ;
104
+
105
+ try {
106
+ const execPath = await puppeteer . resolveExecutablePath ( ) ;
107
+ console . log ( 'Resolved executable path:' , execPath ) ;
108
+ launchConfig . executablePath = execPath ;
109
+ } catch ( err ) {
110
+ console . log ( 'Error resolving executable path:' , err . message ) ;
111
+ }
112
+
113
+ // Add product and channel settings
114
+ launchConfig . product = 'chrome' ;
115
+ launchConfig . channel = 'chrome' ;
116
+
117
+ console . log ( 'Final launch config:' , launchConfig ) ;
85
118
browser = await puppeteer . launch ( launchConfig ) ;
86
119
87
120
// Get browser information
88
- const browserPath = browser . executablePath ( ) ;
89
- const wsEndpoint = browser . wsEndpoint ( ) ;
90
-
91
121
console . log ( 'Browser launched successfully' ) ;
122
+
123
+ const wsEndpoint = browser . wsEndpoint ( ) ;
92
124
console . log ( 'Browser WebSocket endpoint:' , wsEndpoint ) ;
93
- console . log ( `Found Chrome at: ${ browserPath } ` ) ;
94
125
95
- launchOptions . chromePath = browserPath ;
126
+ // Use the launch config's executable path for chrome-launcher
127
+ if ( launchConfig . executablePath ) {
128
+ console . log ( `Using Chrome at: ${ launchConfig . executablePath } ` ) ;
129
+ launchOptions . chromePath = launchConfig . executablePath ;
130
+ } else {
131
+ console . log ( 'Using default Chrome path' ) ;
132
+ }
96
133
} finally {
97
134
if ( browser ) {
98
135
try {
0 commit comments