Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverless Run: custom Puppeteer #214

Open
davodm opened this issue Oct 11, 2023 · 0 comments
Open

Serverless Run: custom Puppeteer #214

davodm opened this issue Oct 11, 2023 · 0 comments

Comments

@davodm
Copy link

davodm commented Oct 11, 2023

Hi, I used the function on a lambda function with puppeteer-core and @sparticuz/chromium based on your document.

But the error I'm facing is:

Unable to launch browser, error message: spawn ETXTBSY
at Cluster. (/var/task/node_modules/puppeteer-cluster/dist/Cluster.js:119:23)

Which comes from node-html-to-image package dependencies.

Here are the versions I'm using:
"puppeteer-core": 21.3.7
"@sparticuz/chromium": 117.0

Here is the way I'm using the function:

// AWS Config
    let AWSconf = {};
    if (!isOffline() && chromium) {
      AWSconf = {
        puppeteer: puppeteerCore,
        puppeteerArgs: {
          args: chromium.args,
          executablePath: await chromium.executablePath(),
          headless: chromium.headless,
          ignoreHTTPSErrors: true,
          defaultViewport: chromium.defaultViewport,
          args: [
            ...chromium.args,
            "--hide-scrollbars",
            "--disable-web-security",
            '--no-sandbox'
          ],
        },
      };
    }
    // Generate the image
    await nodeHtmlToImage({
      html: renderedHtml,
      content: data, // It already using Handlebars
      output: $outputPath + outputFileName,
      transparent: true,
      ...AWSconf,
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant