-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Feature Request
Summary
Add support for custom Chrome arguments (like --no-sandbox, --disable-setuid-sandbox) in the launchBrowser function for headless server environments.
Problem
Currently, launchBrowser uses a fixed set of CHROME_ARGS from constants.js:
export const CHROME_ARGS = [
'--disable-session-crashed-bubble',
'--hide-crash-restore-bubble',
'--disable-infobars',
'--no-first-run',
'--no-default-browser-check',
'--disable-crash-restore',
];However, when running in headless server environments (Docker containers, CI/CD, etc.), additional arguments are often required:
--no-sandbox--disable-setuid-sandbox--disable-dev-shm-usage
Without these args, the browser fails to launch with errors like:
No usable sandbox! If you are running on Ubuntu 23.10+ or another Linux distro that has disabled unprivileged user namespaces with AppArmor...
Proposed Solution
Allow passing custom args in the options parameter of launchBrowser:
const { browser, page } = await launchBrowser({
engine: 'puppeteer',
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'], // Custom args to append
});Use Case
This feature is needed for web-capture integration, which runs in Docker containers and needs sandbox-disabled Chrome for headless rendering.
Current Workaround
Currently, consumers must maintain their own browser launch code that duplicates browser-commander's logic while adding the necessary server-side args.
Alternatives Considered
- Adding server-side args to the default
CHROME_ARGS- but this might not be desired for all use cases - Providing a separate
CHROME_SERVER_ARGSexport - less flexible than option 1
Related PR: link-assistant/web-capture#25