chromium icon indicating copy to clipboard operation
chromium copied to clipboard

[BUG] Navigation timeout issue for most of the invocations

Open mayurvpatil opened this issue 8 months ago • 0 comments

Environment

  • chromium Version: 122.0.0
  • puppeteer-core Version: 22.5.0 / 22.6.0
  • Node.js Version: 20. x
  • Lambda Runtime: nodejs20.x
  • Lambda Memory: 2048MB
  • Lambda Ephemeral storage: 512MB

Executions

We are executing multiple scripts (multiple invocations [~50] of the same lambda ) simultaneously.

Current Behavior

  • Getting Navigation timeout of 20000 ms exceeded at await page.goto(url, { waitUntil: 'load' });
  • The same code base was working before this https://github.com/Sparticuz/chromium/issues/271

Code

import puppeteer from 'puppeteer-core';
import chromium from "@sparticuz/chromium";

export async function handler(event, context,callback) {
  let result = null;
  let browser = null;

  try {

    chromium.setGraphicsMode = true; 
    browser =  await puppeteer.launch({
        args: chromium.args,
        defaultViewport: chromium.defaultViewport,
        executablePath: await chromium.executablePath(),
        headless: true,
        ignoreHTTPSErrors: true,
        devtools: false,
        protocolTimeout: 240000,
        args: [
            "--no-sandbox",
            "--disable-setuid-sandbox",
            "--disable-dev-shm-usage",
            "--single-process",
            "--no-zygote",
        ]
    });

    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);
};
  • Is this because of multiple invocations? I've observed that Puppeteer creates some files in /tmp, is this /tmp shared across invocations?

mayurvpatil avatar Jun 10 '24 21:06 mayurvpatil