playwright-rust icon indicating copy to clipboard operation
playwright-rust copied to clipboard

Running on Lambda Function

Open aydrian opened this issue 4 years ago • 3 comments
trafficstars

Was wondering if anyone has tried getting the to run on a Rust AWS Lambda function? The Node.js side has playwright-aws-lambda to assist. It's currently failing for me because Playwright::initialize() attempts to download the driver to the read-only file system. Wondering if it'd be possible to use Playwright::with_driver(driver) with a driver packaged with the function.

Thank you

aydrian avatar Oct 04 '21 12:10 aydrian

Have you seen Playwright::with_driver?

You can install browsers yourself, and then point Playwright to their location.

Looks like, that's what playwright-aws-lambda does.

d4h0 avatar Oct 20 '21 16:10 d4h0

Have you seen Playwright::with_driver?

You can install browsers yourself, and then point Playwright to their location.

Any examples of how this would look in practice? I'm fairly new to Rust and I'm trying to get this working with Docker. I have it working but the browsers are not persistent between container spin-ups. I have mounted a persistent storage to the container, but I need to figure out how to specify the download location.

physics515 avatar Jul 19 '22 20:07 physics515

Would somebody like to team up and develop a Dockerfile and SAM configuration that would "just run" on AWS Lambda? I have been looking into this for weeks, developed half-done solutions for what looks like all Linux distributions, but cannot manage to finalise it:

Key challenges (no particular order) I have faced:

  • Limited drivers on AL2 -> need for a different Linux Distribution
  • Size of the image should be small: Best would be Alpine, Playwright supports Ubuntu and Debian
  • Rust compilation to arm64 vs amd64
  • Path to the driver vs executable (It is possible to have a working Chromium on Alpine but the driver "playwright.sh" doesn't connect correctly)
  • Temporary folder - EFS configuration
  • User / Group Permissions need to align with Lambda
  • Very slow Dev.Ops. speed to test since it requires everything to recompile and redeploy just to test a small change

I would love to team up with somebody and share the Dockerfiles and SAM configuration so we can provide a solution to the community.

jtomek avatar Aug 03 '22 06:08 jtomek