Become a member
to unlock all features

Create egghead account to access 5000+ tutorials and resources from expert developers.

Create account

    Using Playwright to screenshot the DOM and return an image from a Netlify Function


    We cover installing Playwright, which will run the headless browser for us, in a way that doesn't also install unused browser bundles, reducing the size and allowing us to deploy it to netlify in a function. We also cover a set of Playwright APIs like page.setContent, page.evaluate, page.screenshot, and how to return a base64 encoded image from a lambda function. We also cover passing values from native browser functions like getBoundingClientRect back to our node script and fixing a few errors along the way.