Getting Puppeteer to work in Netlify functions

We had quite a hassle getting Puppeteer working in Netlify functions, but we did and here is proof in a demo project.

We were making a bot for mastodon that scrapes and posts all the gigs happening in Brighton (follow @gigbot here!) – we were using Puppeteer and Cheerio to scrape the venue pages for listings but while it would woRK on OuR mAChiNe it crapped out whenever we pushed it up to Netlify.

It turned out to be mostly trial and error finding the correct mix of Chromium and Puppeteer-Core that worked on Netlify functions (Node 18) but it mostly boiled down to these settings.



"dependencies": {
  "@sparticuz/chromium": "113.0.1",
  "puppeteer-core": "20.1.1"


  node_bundler = "esbuild"
  external_node_modules = ["@sparticuz/chromium"]


CHROME_EXECUTABLE_PATH="/Applications/Google Chrome"

We hope this saves someone else a load of time.