The current layer build is not working properly
Closed this issue · 5 comments
Hi there. Thanks for providing this. I've found that the latest build (arn:aws:lambda:us-east-1:764866452798:layer:chrome-aws-lambda:8) is no longer working (at least with the chrome-aws-lambda example script).
Here is the error that is raised:
{
"errorType": "Error",
"errorMessage": "Failed to launch chrome!\n/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n",
"trace": [
"Error: Failed to launch chrome!",
"/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory",
"",
"",
"TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md",
"",
" at onClose (/opt/nodejs/node_modules/puppeteer-core/lib/Launcher.js:348:14)",
" at Interface.<anonymous> (/opt/nodejs/node_modules/puppeteer-core/lib/Launcher.js:337:50)",
" at Interface.emit (events.js:228:7)",
" at Interface.close (readline.js:402:8)",
" at Socket.onend (readline.js:180:10)",
" at Socket.emit (events.js:228:7)",
" at endReadableNT (_stream_readable.js:1185:12)",
" at processTicksAndRejections (internal/process/task_queues.js:81:21)"
]
}My handler is the unmodified example from chrome-aws-lambda:
const chromium = require('chrome-aws-lambda');
exports.handler = async (event, context) => {
let result = null;
let browser = null;
try {
browser = await chromium.puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless,
});
let page = await browser.newPage();
await page.goto(event.url || 'https://example.com');
result = await page.title();
} catch (error) {
return context.fail(error);
} finally {
if (browser !== null) {
await browser.close();
}
}
return context.succeed(result);
};The only changes I made to my Lambda config was to increase the timeout to 30 seconds and memory to 512 MB.
Hey @jbrowning, are you using Node.js 12 as your Lambda runtime?
are you using Node.js 12 as your Lambda runtime
Correct. Node 12 does work by default with a manual layer build of chrome-aws-lambda master.
I also got this error on Node 12 - Switching to Node 10 it worked properly. I look forward to an update to this issue - Thank you for taking the time to fix this.
Could you please try the latest layer version 10? It works for us on Node 12 just fine
Works for me. Thanks for the quick response and fix.