oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.12k stars 2.76k forks source link

Puppeteer.connect works on Node.js but doesn't work on Bun #8320

Open MuhibAhmed opened 9 months ago

MuhibAhmed commented 9 months ago

What version of Bun is running?

1.0.10+d85bd49d8

What platform is your computer?

Linux 5.15.133.1-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

Run this code,

const puppeteer = require("puppeteer");

const SBR_WS_ENDPOINT =

  "[External Browser WSS URL";

async function main() {

  console.log("Connecting to Scraping Browser...");

  const browser = await puppeteer.connect({

    browserWSEndpoint: SBR_WS_ENDPOINT,

  });

  try {

    const page = await browser.newPage();

    console.log("Connected! Navigating to https://google.com...");

    await page.goto("https://google.com");

    console.log("Navigated! Scraping page content...");

    const html = await page.content();

    console.log(html);

  } finally {

    await browser.close();

  }

}

main().catch((err) => {

  console.error(err.stack || err);

  process.exit(1);

});

What is the expected behavior?

HTML content of the google.com page.

What do you see instead?

Stuck at

const browser = await puppeteer.connect({

    browserWSEndpoint: SBR_WS_ENDPOINT,

  });

Additional information

No response

youcefs21 commented 7 months ago

I'm running into the same issue, hangs on .connect