[BUG] Failed to launch chrome
See original GitHub issueEnvironment
chrome-aws-lambda
:2puppeteer
/puppeteer-core
:2- OS: osx docker lambda working but lambda runtime node12.x not working
- Node.js Version:12
- Lambda / GCF Runtime:Lambda
Expected Behavior
It should work.
Current Behavior
Lambda response
{
"errorMessage": "Failed to launch chrome!\n\n\nTROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md\n",
"errorType": "Error",
"stackTrace": [
"",
"",
"TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md",
"",
"onClose (/var/task/node_modules/puppeteer-core/lib/Launcher.js:348:14)",
"Interface.helper.addEventListener (/var/task/node_modules/puppeteer-core/lib/Launcher.js:337:50)",
"emitNone (events.js:111:20)",
"Interface.emit (events.js:208:7)",
"Interface.close (readline.js:370:8)",
"Socket.onend (readline.js:149:10)",
"emitNone (events.js:111:20)",
"Socket.emit (events.js:208:7)",
"endReadableNT (_stream_readable.js:1064:12)",
"_combinedTickCallback (internal/process/next_tick.js:138:11)"
]
}
Steps to Reproduce
1- save to index.js
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://github.com");
title = await page.title();
} catch (error) {
return context.fail(error);
} finally {
if (browser !== null) {
await browser.close();
}
}
return context.succeed(title)
};
2- npm install puppeteer-core chrome-aws-lambda --save-prod
3- create zip and deploy lambda with runtime node12.x. occur this error.
Thanks,
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:32 (7 by maintainers)
Top Results From Across the Web
[Bug]: Failed to launch chrome · Issue #9029 - GitHub
Steps to reproduce the problem: ./node_modules/puppeteer/.local-chromium/linux-1036745/chrome-linux/chrome -v --no-sandbox --disable ...
Read more >Fix Chrome if it crashes or won't open - Computer
First: Try these common Chrome crash fixes · Close every tab except for the one that's showing the error message. · Quit other...
Read more >Unable to launch chrome-42 in CentOS-6 - Google Groups
After updating Chrome to 42 version (on CentOS 6.6 ), i was unable to launch the chrome. It is simply dumping core. Filed...
Read more >unable to launch chrome : Conflict with System Mechanics ...
Issue 65 : unable to launch chrome : Conflict with System Mechanics Professional · 1. download ChromeSetup.exe · 2. execute ChromeSetup.exe and wait...
Read more >Troubleshooting - Puppeteer
Chrome is downloaded but fails to launch on Node.js 14 ... The bug was fixed in Node.js v14.1.0, so please make sure you're...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I got this to work by only using
await chromium.executablePath
in prod as I know this issue has been resolved in cloud functions. I am not exactly sure why this works and didn’t have the time to look into it but it does.Fail when run locally without API Gateway (I’m using serverless framework). With serverless + serverless_offline plugin works as expected!