-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Playwright error - ChildProcess.stdio from child_process.spawn({ stdio: ["pipe"] }) has only null values #4253
Description
What version of Bun is running?
0.7.3
What platform is your computer?
Darwin 22.3.0 x86_64 i386
What steps can reproduce the bug?
I wanted to run a web scraper in the Apify/Crawlee framework. The scraper uses Playwright via PlaywrightCrawler. This works on Node, but I wanted to see if it can work on Bun too. I resolved issues on the Apify side, and then I came across issues in playwright-core.
I was getting an error undefined is not an object (evaluating 'pipeRead.on').
I found that the pipeRead is coming from a child process in playwright-core in file processLauncher.ts in line 138 which calls childProcess.spawn:
const spawnedProcess = childProcess.spawn(options.command, options.args || [], spawnOptions);The spawn command was called with following input:
childProcess.spawn(
"/Users/presenter/Library/Caches/ms-playwright/chromium-1076/chrome-mac/Chromium.app/Contents/MacOS/Chromium",
[ "--disable-field-trial-config", "--disable-background-networking", "--enable-features=NetworkService,NetworkServiceInProcess",
"--disable-background-timer-throttling", "--disable-backgrounding-occluded-windows",
"--disable-back-forward-cache", "--disable-breakpad", "--disable-client-side-phishing-detection",
"--disable-component-extensions-with-background-pages", "--disable-component-update",
"--no-default-browser-check", "--disable-default-apps", "--disable-dev-shm-usage", "--disable-extensions",
"--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate",
"--allow-pre-commit-input", "--disable-hang-monitor", "--disable-ipc-flooding-protection",
"--disable-popup-blocking", "--disable-prompt-on-repost", "--disable-renderer-backgrounding",
"--force-color-profile=srgb", "--metrics-recording-only", "--no-first-run", "--enable-automation",
"--password-store=basic", "--use-mock-keychain", "--no-service-autorun", "--export-tagged-pdf",
"--enable-use-zoom-for-dsf=false", "--use-angle", "--headless", "--hide-scrollbars", "--mute-audio",
"--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4",
"--no-sandbox", "--proxy-server=http://127.0.0.1:51234", "--proxy-bypass-list=<-loopback>",
"--disable-blink-features=AutomationControlled", "--user-data-dir=/var/folders/58/s9p_yjr94nb9pksrl4ml8c_r0000gp/T/playwright_chromiumdev_profile-S7dmrm",
"--remote-debugging-pipe", "about:blank"
],
{
detached: true,
env: {
MallocNanoZone: "0",
COMMAND_MODE: "unix2003",
__CFBundleIdentifier: "com.microsoft.VSCode",
PATH: "/Users/presenter/.poetry/bin:/Users/presenter/.nvm/versions/node/v16.13.0/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/presenter/.poetry/bin:/Users/presenter/.nvm/versions/node/v16.13.0/bin:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/Users/presenter/flutter/bin:/Users/presenter/Library/Android/sdk/tools/bin:/Users/presenter/flutter/bin:/Users/presenter/Library/Android/sdk/tools/bin",
XPC_SERVICE_NAME: "0",
SSH_AUTH_SOCK: "/private/tmp/com.apple.launchd.qpKNVl80R6/Listeners",
XPC_FLAGS: "0x0",
LOGNAME: "presenter",
USER: "presenter",
HOME: "/Users/presenter",
SHELL: "/bin/zsh",
TMPDIR: "/var/folders/58/s9p_yjr94nb9pksrl4ml8c_r0000gp/T/",
__CF_USER_TEXT_ENCODING: "0x1F6:0x0:0x2",
ORIGINAL_XDG_CURRENT_DESKTOP: "undefined",
SHLVL: "1",
PWD: "/Users/presenter/repos/apify-actor-facebook",
OLDPWD: "/Users/presenter/repos",
NVM_DIR: "/Users/presenter/.nvm",
NVM_CD_FLAGS: "-q",
NVM_BIN: "/Users/presenter/.nvm/versions/node/v16.13.0/bin",
NVM_INC: "/Users/presenter/.nvm/versions/node/v16.13.0/include/node",
TERM_PROGRAM: "vscode",
TERM_PROGRAM_VERSION: "1.81.1",
LANG: "en_US.UTF-8",
COLORTERM: "truecolor",
GIT_ASKPASS: "/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh",
VSCODE_GIT_ASKPASS_NODE: "/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)",
VSCODE_GIT_ASKPASS_EXTRA_ARGS: "--ms-enable-electron-run-as-node",
VSCODE_GIT_ASKPASS_MAIN: "/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js",
VSCODE_GIT_IPC_HANDLE: "/var/folders/58/s9p_yjr94nb9pksrl4ml8c_r0000gp/T/vscode-git-4f97872c73.sock",
VSCODE_INJECTION: "1",
ZDOTDIR: "/Users/presenter",
USER_ZDOTDIR: "/Users/presenter",
TERM: "xterm-256color",
_: "/Users/presenter/.nvm/versions/node/v16.13.0/bin/bun",
TZ: undefined
},
cwd: undefined,
shell: undefined,
stdio: [ "ignore", "pipe", "pipe", "pipe", "pipe" ]
}Playwright then works with ChildProcess.stdio value, which in Node resolves to:
stdio: [
null,
Socket,
Socket,
Socket,
Socket
}While in Bun, it resolves to:
stdio: {
"0": null,
"1": null,
"2": null
}Since Bun returns nulls from ChildProcess.stdio then when the missing Sockets are accessed as pipeRead.on, that's what causes the error.
This raises several questions:
- Why are the Sockets missing in Bun?
- Why does
ChildProcess.stdioin Bun has only 3 items when Node has 5?- From my limited knowledge what I just read, I assume that the 3 are stdin, stdout, and stderr? Imlpying that Bun doesn't support additional pipes?
- Why is the value of
ChildProcess.stdioan array in Node, but an object in Bun?
This is all I could dig out. I didn't work with Sockets before, so this is already beyond me.
Hope this can give you sufficient pointers to resolve this issue, and thanks for your time!
NOTE: This is just the first error I came across when trying to run Playwright, there may be more once this one is resolved.
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response