~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix: Improve Chrome detection with comprehensive logging and Puppeteer fallback
LearningCircuit416383a1c811
diff --git a/Dockerfile b/Dockerfileindex 4773740b7b..e7c00f47da 100644--- a/Dockerfile+++ b/Dockerfile@@ -68,24 +68,37 @@ RUN apt-get update && apt-get install -y \# Set up Puppeteer environmentENV PUPPETEER_CACHE_DIR=/app/puppeteer-cacheENV DOCKER_ENV=true-ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true+# Don't skip Chrome download - let Puppeteer download its own Chrome as fallback+# ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true# Create puppeteer cache directory with proper permissionsRUN mkdir -p /app/puppeteer-cache && chmod -R 777 /app/puppeteer-cache# Install Playwright with Chromium first (before npm packages)-RUN playwright install --with-deps chromium+RUN playwright install --with-deps chromium || echo "Playwright install failed, will use Puppeteer's Chrome"# Copy test package filesCOPY tests/api_tests_with_login/package.json /install/tests/api_tests_with_login/COPY tests/ui_tests/package.json /install/tests/ui_tests/-# Install npm packages (Skip Chrome download, will use Playwright's Chromium)+# Install npm packages - Puppeteer will download Chrome since PUPPETEER_SKIP_CHROMIUM_DOWNLOAD is not setWORKDIR /install/tests/api_tests_with_loginRUN npm installWORKDIR /install/tests/ui_testsRUN npm install+# Set CHROME_BIN to help Puppeteer find Chrome+# Try to find and set Chrome binary path+RUN CHROME_PATH=$(find /root/.cache/ms-playwright -name chrome -type f 2>/dev/null | head -1) && \+ if [ -n "$CHROME_PATH" ]; then \+ echo "export CHROME_BIN=$CHROME_PATH" >> /etc/profile.d/chrome.sh; \+ else \+ CHROME_PATH=$(find /app/puppeteer-cache -name chrome -type f 2>/dev/null | head -1) && \+ if [ -n "$CHROME_PATH" ]; then \+ echo "export CHROME_BIN=$CHROME_PATH" >> /etc/profile.d/chrome.sh; \+ fi; \+ fi || true+# Copy test files to /app where they will be run fromRUN mkdir -p /app && cp -r /install/tests /app/diff --git a/tests/ui_tests/puppeteer_config.js b/tests/ui_tests/puppeteer_config.jsindex b7da7913c0..b0fd9206f8 100644--- a/tests/ui_tests/puppeteer_config.js+++ b/tests/ui_tests/puppeteer_config.js@@ -19,7 +19,22 @@ function getPuppeteerLaunchOptions(additionalOptions = {}) {// In Docker/CI environments, explicitly skip Chrome download and use system Chrome/Chromiumif (process.env.CI || process.env.DOCKER_ENV) {console.log('🔍 Detecting Chrome/Chromium in CI/Docker environment...');- console.log(`Environment: CI=${process.env.CI}, DOCKER_ENV=${process.env.DOCKER_ENV}`);+ console.log(`📊 Environment Variables:`);+ console.log(` - CI=${process.env.CI}`);+ console.log(` - DOCKER_ENV=${process.env.DOCKER_ENV}`);+ console.log(` - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=${process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD}`);+ console.log(` - PUPPETEER_CACHE_DIR=${process.env.PUPPETEER_CACHE_DIR}`);+ console.log(` - CHROME_BIN=${process.env.CHROME_BIN}`);++ const { execSync } = require('child_process');+ const fs = require('fs');++ // Check if CHROME_BIN is set and valid+ if (process.env.CHROME_BIN && fs.existsSync(process.env.CHROME_BIN)) {+ console.log(`✅ Using CHROME_BIN environment variable: ${process.env.CHROME_BIN}`);+ defaultOptions.executablePath = process.env.CHROME_BIN;+ return { ...defaultOptions, ...additionalOptions };+ }// Try to use Playwright's Chromium if availableconst possiblePaths = [@@ -29,56 +44,119 @@ function getPuppeteerLaunchOptions(additionalOptions = {}) {'/usr/bin/chromium-browser','/usr/bin/chromium','/usr/bin/google-chrome',- '/usr/bin/google-chrome-stable'+ '/usr/bin/google-chrome-stable',+ // Add puppeteer cache paths+ '/app/puppeteer-cache/chrome/linux-*/chrome-linux/chrome',+ '/root/.cache/puppeteer/chrome/linux-*/chrome-linux/chrome'];- const { execSync } = require('child_process');- const fs = require('fs');-console.log('📂 Searching for Chrome/Chromium binaries...');- // First, try to find Playwright's chromium using a more reliable method+ // First, check common directories for any chrome/chromium executables+ console.log('🔎 Checking for Chrome/Chromium in common locations:');try {- console.log('Looking for Playwright\'s Chromium...');- const playwrightPath = execSync('find /root/.cache/ms-playwright -name chrome -type f 2>/dev/null | head -1', { encoding: 'utf8' }).trim();- if (playwrightPath && fs.existsSync(playwrightPath)) {- console.log(`✅ Found Playwright's Chromium at: ${playwrightPath}`);- defaultOptions.executablePath = playwrightPath;- } else {- console.log('⚠️ Playwright\'s Chromium not found in cache');+ const findResults = execSync('find /usr/bin /usr/lib /opt -name "*chrom*" -type f -executable 2>/dev/null | head -10', { encoding: 'utf8' }).trim();+ if (findResults) {+ console.log(' Found executables:');+ findResults.split('\n').forEach(path => console.log(` - ${path}`));}} catch (e) {- console.log('⚠️ Could not search for Playwright\'s Chromium:', e.message);+ console.log(' Could not search /usr directories');+ }++ // Check Playwright cache locations+ console.log('🎭 Checking Playwright cache locations:');+ const playwrightDirs = ['/root/.cache/ms-playwright', '/ms-playwright', '/.cache/ms-playwright'];+ for (const dir of playwrightDirs) {+ try {+ if (fs.existsSync(dir)) {+ console.log(` 📁 Found Playwright cache dir: ${dir}`);+ const contents = execSync(`ls -la ${dir} 2>/dev/null | head -5`, { encoding: 'utf8' }).trim();+ if (contents) {+ console.log(` Contents: ${contents.split('\n')[0]}`);+ }- // Fall back to checking specific paths- console.log('🔍 Checking standard Chrome/Chromium paths...');+ // Try to find chrome executable+ const chromePath = execSync(`find ${dir} -name chrome -type f 2>/dev/null | head -1`, { encoding: 'utf8' }).trim();+ if (chromePath && fs.existsSync(chromePath)) {+ console.log(` ✅ Found Playwright Chrome at: ${chromePath}`);+ defaultOptions.executablePath = chromePath;+ break;+ }+ } else {+ console.log(` ❌ Directory not found: ${dir}`);+ }+ } catch (e) {+ console.log(` ⚠️ Error checking ${dir}: ${e.message}`);+ }+ }++ // Check Puppeteer cache locations+ if (!defaultOptions.executablePath) {+ console.log('🐶 Checking Puppeteer cache locations:');+ const puppeteerDirs = [+ process.env.PUPPETEER_CACHE_DIR || '/app/puppeteer-cache',+ '/root/.cache/puppeteer',+ '/.cache/puppeteer'+ ];++ for (const dir of puppeteerDirs) {+ try {+ if (fs.existsSync(dir)) {+ console.log(` 📁 Found Puppeteer cache dir: ${dir}`);+ const chromePath = execSync(`find ${dir} -name chrome -type f 2>/dev/null | head -1`, { encoding: 'utf8' }).trim();+ if (chromePath && fs.existsSync(chromePath)) {+ console.log(` ✅ Found Puppeteer Chrome at: ${chromePath}`);+ defaultOptions.executablePath = chromePath;+ break;+ }+ } else {+ console.log(` ❌ Directory not found: ${dir}`);+ }+ } catch (e) {+ console.log(` ⚠️ Error checking ${dir}: ${e.message}`);+ }+ }+ }++ // Fall back to checking specific paths+ if (!defaultOptions.executablePath) {+ console.log('🔍 Checking standard Chrome/Chromium paths:');for (const pathPattern of possiblePaths) {- console.log(` Checking: ${pathPattern}`);try {const chromiumPath = execSync(`ls ${pathPattern} 2>/dev/null | head -1`, { encoding: 'utf8' }).trim();if (chromiumPath && chromiumPath.length > 0 && fs.existsSync(chromiumPath)) {- console.log(` ✅ Found Chromium at: ${chromiumPath}`);- defaultOptions.executablePath = chromiumPath;- break;- } else {- console.log(` ❌ Not found or not accessible`);+ console.log(` ✅ Found at: ${chromiumPath}`);+ // Verify it's executable+ const stats = fs.statSync(chromiumPath);+ if (stats.mode & fs.constants.S_IXUSR) {+ defaultOptions.executablePath = chromiumPath;+ break;+ } else {+ console.log(` ⚠️ File exists but is not executable`);+ }}} catch (e) {- console.log(` ❌ Error checking path: ${e.message}`);+ // Silent fail for glob patterns}}}if (!defaultOptions.executablePath) {- console.warn('⚠️ Could not find Chrome/Chromium binary, Puppeteer will try to use its own');- console.warn('Available environment variables:', Object.keys(process.env).filter(k => k.includes('CHROME') || k.includes('PUPPETEER')));+ console.warn('⚠️ Could not find Chrome/Chromium binary in standard locations');+ console.warn('📋 Debug Information:');+ console.warn(` - Current working directory: ${process.cwd()}`);+ console.warn(` - PATH: ${process.env.PATH}`);+ console.warn(` - Chrome-related env vars:`, Object.keys(process.env).filter(k => k.includes('CHROME') || k.includes('PUPPETEER')));- // In CI, we should fail fast rather than hanging+ // In CI, try to use Puppeteer's bundled Chrome as last resortif (process.env.CI) {- console.error('❌ ERROR: Chrome/Chromium binary required for CI tests');- console.error('Please ensure Playwright is installed with: playwright install --with-deps chromium');- console.error('Or set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false to use Puppeteer\'s bundled Chrome');- process.exit(1);+ console.log('🚨 CI Mode: Attempting to use Puppeteer\'s bundled Chrome...');+ console.log(' Note: This requires PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to be unset or false');++ // Don't exit, let Puppeteer try to use its own Chrome+ console.log(' Proceeding without explicit executablePath - Puppeteer will use its bundled Chrome');+ // Remove the explicit failure, let Puppeteer handle it}} else {console.log(`🚀 Will launch Puppeteer with executable: ${defaultOptions.executablePath}`);