Does not work
I have tried multiple ways for the last few days. Works perfectly fine locally but does not want to work on lambda, i have even tried Puppeteer with all the plugins i could find nothing works if anyone has something actually working in lambda let me know.
I think for now the best bet is full blown Docker and i have a mac silicone chip, yay https://github.com/JupiterOne/playwright-aws-lambda/issues/74
Hello, I got it working today. It only worked for me with the following setup with NodeJS.
- The dependencies in the package.json with these versions
“dependencies": { “playwright-aws-lambda": ‘^0.10.0’, “playwright-core": ”^1.49.1” }
- NodeJs version 18.
- In AWS Lambda (x86_64) manually lock the Node version to this version: arn:aws:lambda:us-east-1::runtime:0cdcfbdefbc5e7d3343f73c2e2dd3cba17d61dea0686b404502a0c9ce83931b9
This also worked in Ohio for me... arn:aws:lambda:us-east-2::runtime:0cdcfbdefbc5e7d3343f73c2e2dd3cba17d61dea0686b404502a0c9ce83931b9
Thanks @F3lixP4lm, I'm faced issue like
[pid=13][err] /tmp/chromium: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory
I got things working by swapping to sparticruz + playwright-core
const chromium = require('@sparticuz/chromium');
const { chromium: playwright } = require('playwright-core');
// In your handler route...
const browser = await playwright.launch({
args: chromium.args,
executablePath: await chromium.executablePath(),
headless: chromium.headless,
chromiumSandbox: false,
});
const context = await browser.newContext();
const page = await context.newPage();
I got things working by swapping to sparticruz + playwright-core
const chromium = require('@sparticuz/chromium'); const { chromium: playwright } = require('playwright-core');
// In your handler route... const browser = await playwright.launch({ args: chromium.args, executablePath: await chromium.executablePath(), headless: chromium.headless, chromiumSandbox: false, }); const context = await browser.newContext(); const page = await context.newPage();
What node version are you using?