Skip to content

Commit 54109fd

Browse files
committed
more logging
1 parent b346185 commit 54109fd

File tree

1 file changed

+42
-5
lines changed

1 file changed

+42
-5
lines changed

src/run-lighthouse.js

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ export const runLighthouse = async (url, settings) => {
2727
// Launch Chrome using puppeteer
2828
try {
2929
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+
3049
// Check for Chrome in Netlify environment first
3150
const chromePaths = [
3251
'/opt/buildhome/.cache/puppeteer/chrome/linux-119.0.6045.105/chrome-linux64/chrome',
@@ -82,17 +101,35 @@ export const runLighthouse = async (url, settings) => {
82101
};
83102

84103
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);
85118
browser = await puppeteer.launch(launchConfig);
86119

87120
// Get browser information
88-
const browserPath = browser.executablePath();
89-
const wsEndpoint = browser.wsEndpoint();
90-
91121
console.log('Browser launched successfully');
122+
123+
const wsEndpoint = browser.wsEndpoint();
92124
console.log('Browser WebSocket endpoint:', wsEndpoint);
93-
console.log(`Found Chrome at: ${browserPath}`);
94125

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+
}
96133
} finally {
97134
if (browser) {
98135
try {

0 commit comments

Comments
 (0)