Getting "undefined is not an object" in puppeteer
What version of Bun is running?
1.0.6
What platform is your computer?
Linux 6.2.0-1012-aws x86_64 x86_64
What steps can reproduce the bug?
const cheerio = require('cheerio');
const puppeteer = require('puppeteer');
const brower = await puppeteer.launch({ executablePath: '/snap/bin/chromium', headless: "new", args: ['--no-sandbox', '--disable-http2'] });
const browser = await puppeteer.launch({ executablePath: '/usr/bin/chromium-browser', headless: "new", args: ['--no-sandbox', '--disable-http2'] });
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle2' });
const html = await page.content();
browser.close();
What is the expected behavior?
This should give no type error for node inbuild module
What do you see instead?
809 | this[kTtyWrite](d, key);
810 | else
811 | this[kNormalWrite](d);
812 | }
813 |
814 | [kNormalWrite](b) {
^
TypeError: undefined is not an object
at node:readline:814:32
at node:readline:517:40
at node:stream:1993:76
at node:stream:2188:80
at node:stream:1743:322
at node:readline:535:68
at new (node:readline:586:46)
at node:readline:597:58
But it is giving me response from puppeteer
Additional information
The same code is working in Node.js
Confirming this issue.
More details here: https://github.com/oven-sh/bun/issues/5416
For now the solution was to install puppeteer-core and custom chrome for testing matching your OS.
Getting the same error here, I tested my program on Fedora 38 and it works without problems, When I try to run it on an Almalinux server it throws the same error no matters what I do, I already installed chrome for testing and changed the executable paths
Does this still reproduce for you? this is working for me on Bun 1.1.8 (you may need to run bun upgrade)
I used the following code
const puppeteer = require("puppeteer");
const browser = await puppeteer.launch({
executablePath: "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
headless: "new",
args: ["--no-sandbox", "--disable-http2"],
});
const page = await browser.newPage();
const url = "https://example.com";
await page.goto(url, { waitUntil: "networkidle2" });
const html = await page.content();
browser.close();
console.log(html);
Does this still reproduce for you? this is working for me on Bun 1.1.8 (you may need to run
bun upgrade)I used the following code
const puppeteer = require("puppeteer"); const browser = await puppeteer.launch({ executablePath: "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary", headless: "new", args: ["--no-sandbox", "--disable-http2"], }); const page = await browser.newPage(); const url = "https://example.com"; await page.goto(url, { waitUntil: "networkidle2" }); const html = await page.content(); browser.close(); console.log(html);
Working fine, bun (1.1.10+5102a9443) on Win and on Ubuntu, also under WSL (headless and headfull, both are working as intended).
Probably this can be closed :)