Sparticuz / chromium

Chromium (x86-64) for Serverless Platforms
MIT License
1.02k stars 71 forks source link

[BUG] Version 123.0.x hangs with Node 18 but works on Node 20 #265

Closed jmandawg closed 7 months ago

jmandawg commented 7 months ago

Environment

Expected Behavior

Example code below should run.

Current Behavior

Hangs on browser.newPage

Steps to Reproduce

const chromium = require('chromium');

exports.handler = async (event, context, callback) => {
  let result = null;
  let browser = null;

  try {
    browser = await puppeteer.launch({
      args: chromium.args,
      defaultViewport: chromium.defaultViewport,
      executablePath: await chromium.executablePath(),
      headless: chromium.headless,
      ignoreHTTPSErrors: true,
    });

    let page = await browser.newPage();

    await page.goto(event.url || 'https://example.com');

    result = await page.title();
  } catch (error) {
    return callback(error);
  } finally {
    if (browser !== null) {
      await browser.close();
    }
  }

  return callback(null, result);
};
jmandawg commented 7 months ago

sorry need to do more research, something is causing it to hang when running in AWS.