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

[BUG] Failed to launch the browser process! on AWS Lambda #263

Open
sriramwarsaicharan opened this issue Apr 23, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@sriramwarsaicharan
Copy link

Environment

  • @sparticuz/chromium Version: 123.0.1
  • puppeteer-core Version: 22.6.3
  • Node.js Version: 20
  • Lambda / GCF Runtime: 20

Expected Behavior

I need to open the browser on aws lambda.

Current Behavior

"OUT:Error: Failed to launch the browser process!\n\n\nTROUBLESHOOTING: https://pptr.dev/troubleshooting\n"

TROUBLESHOOTING: https://pptr.dev/troubleshooting

at Interface.onClose (/opt/nodejs/node_modules/@puppeteer/browsers/lib/cjs/launch.js:310:24)
at Interface.emit (node:events:530:35)
at Interface.emit (node:domain:488:12)
at Interface.close (node:internal/readline/interface:527:10)
at Socket.onend (node:internal/readline/interface:253:10)
at Socket.emit (node:events:530:35)
at Socket.emit (node:domain:488:12)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Steps to Reproduce

const puppeteer = require("puppeteer-core");
const chromium = require("@sparticuz/chromium");
const aws = require('aws-sdk');
const fs = require('fs')

exports.handler = async (event, context, callback) => {
let result = null;
let browser = null;

try {
browser = await puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath(),
headless: chromium.headless,
ignoreHTTPSErrors: true,
});

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);
};

@sriramwarsaicharan sriramwarsaicharan added the bug Something isn't working label Apr 23, 2024
@sriramwarsaicharan sriramwarsaicharan changed the title [BUG] [BUG] Failed to launch the browser process! on AWS Lambda Apr 23, 2024
@sriramwarsaicharan sriramwarsaicharan changed the title [BUG] Failed to launch the browser process! on AWS Lambda [BUG] [help wanted] Failed to launch the browser process! on AWS Lambda Apr 23, 2024
@sriramwarsaicharan sriramwarsaicharan changed the title [BUG] [help wanted] Failed to launch the browser process! on AWS Lambda [BUG] [HELP WANTED] Failed to launch the browser process! on AWS Lambda Apr 23, 2024
@sriramwarsaicharan sriramwarsaicharan changed the title [BUG] [HELP WANTED] Failed to launch the browser process! on AWS Lambda [BUG] Failed to launch the browser process! on AWS Lambda Apr 23, 2024
@sriramwarsaicharan
Copy link
Author

I need help to make this browser run on aws lambda in headless mode

@riyahudle
Copy link

Facing same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants