Playwright: [Feature] Support for AWS Lambda / Serverless environments

Created on 29 May 2020  路  8Comments  路  Source: microsoft/playwright

A lot of users try to use Puppeteer and Playwright in special environments like on Vercel (formerly ZEIT) which is based on Amazon Linux 2 / Lamda or directly on AWS Lamda. Also there are quite a few interesting use cases for Google Cloud Functions / Azure Functions.

Would be good to investigate into them, if separate browser binaries can be provided for that or an official buildpack for Heroku.

Probably it does not make sense to support all the browsers there, only Chromium would be already a big win.

(also userspace is possible)

@pavelfeldman what do you think?

Ref:

For AWS Lambda / Google Cloud / Vercel functions this works currently: https://github.com/JupiterOne/playwright-aws-lambda

P3-collecting-feedback

Most helpful comment

Hi @mxschmitt -first of all, thanks for the awesome library! 馃槃

The current support for AWS Lambda is partial (only chromium works). As far as I know, porting Firefox and Webkit to Lambda would require static compiling all the missing libraries + applying the playwright patches.

Since the playwright team is already preparing other browser images, could you also prepare Lambda compatible binaries for Webkit and FF? That would be enormously helpful. Even some suggestions on how to tackle this problem would be great. The playwright-aws-lambda project does not seem very active.

All 8 comments

+1

any news?

Closed, since for AWS Lambda based systems this can be used and for Heroku https://github.com/mxschmitt/heroku-playwright-buildpack buildpack should now work too.

Hi @mxschmitt -first of all, thanks for the awesome library! 馃槃

The current support for AWS Lambda is partial (only chromium works). As far as I know, porting Firefox and Webkit to Lambda would require static compiling all the missing libraries + applying the playwright patches.

Since the playwright team is already preparing other browser images, could you also prepare Lambda compatible binaries for Webkit and FF? That would be enormously helpful. Even some suggestions on how to tackle this problem would be great. The playwright-aws-lambda project does not seem very active.

@jan-osch I full agree. I reopened it to keep track on solutions to run Firefox and WebKit in serverless functions. Having this out of the box would be great.

Closed, since for AWS Lambda based systems this can be used and for Heroku https://github.com/mxschmitt/heroku-playwright-buildpack buildpack should now work too.

What about Azure support? I'm currently running into the same 'failed to launch browser' error while trying to launch browser from an Azure App Service. Same for an Azure Function with dockerized container.

And Thanks a TON for the heroku build pack. You just saved more than just my day.

@CyberV for Azure Functions, you can follow this example by @arjun27: https://github.com/arjun27/playwright-azure-functions

@CyberV, thanks for the comment. This is the current state of running Playwright on Azure Functions:

  • Azure Functions Linux: Chromium can run on the Linux consumption (basic) plan, without any additional dependencies. Firefox and WebKit require the Linux premium plan, with a custom docker setup. @mxschmitt has shared an example above.
  • Azure Functions Windows: running headless browsers is not supported, due to missing Windows libs.

Are you running on Windows?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andyricchuiti picture andyricchuiti  路  4Comments

grajesh690 picture grajesh690  路  3Comments

kblok picture kblok  路  4Comments

kblok picture kblok  路  3Comments

juliomatcom picture juliomatcom  路  3Comments