fix: await async VirtualDisplay.get() (fixes 'cannot open display: [object Promise]' on Docker/Linux)#5651
Open
Kyzcreig wants to merge 1 commit into
Open
Conversation
camoufox-js's VirtualDisplay.get() is async (returns Promise<string> like
':0'), but server.js called it without await:
vdDisplay = localVirtualDisplay.get();
So vdDisplay was a Promise, passed to launchOptions({ virtual_display }) and
stringified to '[object Promise]', causing every browser launch on Linux/Docker
to fail with:
Error: cannot open display: [object Promise]
This breaks the Docker deployment entirely (browserRunning stays false; every
/tabs request 500s). Add the missing await so a real display string (':0') is
passed. Verified: browser launches, /tabs works, beats a Cloudflare bot-test
page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
camoufox-js'sVirtualDisplay.get()is async (returnsPromise<string>like':0'), butlaunchBrowserInstance()inserver.jscalls it withoutawait:So
vdDisplayis aPromise, which is then passed tolaunchOptions({ virtual_display: vdDisplay })and stringified to"[object Promise]". Every Camoufox launch on Linux/Docker then fails with:This breaks the Docker deployment entirely —
/healthshowsbrowserRunning: false,browserConnected: false, the background pre-warm retries forever, and everyPOST /tabsreturns500 Internal server error. The log shows the tell:"xvfb virtual display started", "display": {}(an unresolved Promise rendered as{}) immediately followed by the launch failure.Fix
Add the missing
await:launchBrowserInstance()is alreadyasyncandawaitslaunchOptions(...)a few lines below, so this is safe. After the fix the log correctly shows"display": ":0"and"camoufox launched".Verification
Built the image (
make build && make up) on an arm64 Mac (Docker), confirmed:GET /health→{"ok":true,"browserConnected":true,"browserRunning":true,...}POST /tabsforhttps://nowsecure.nl(a Cloudflare bot-detection test page) → tab created,GET /tabs/:id/snapshotreturns the success content (NOWSECUREheadings) with no Cloudflare interstitial.One-line change; no behavior change beyond fixing the broken Linux/virtual-display launch path.