node-html-to-image
node-html-to-image copied to clipboard
Serverless Run: custom Puppeteer
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,
});