Skip to content

A demo project showing puppeteer working on netlify functions

Notifications You must be signed in to change notification settings

blackspike/netlify-puppeteer-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Netlify Puppeteer Demo

We had a real hassle getting puppeteer working on Netlify, but we did! And here is a demo project for our reference.

Demo

https://puppeteer-demo.netlify.app

Settings

package.json:

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

netlify.toml:

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

.env

CHROME_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

NOTE

We recieved some feedback, so you may want to try this if you're having problems!

This line did not work for me:

executablePath: process.env.CHROME_EXECUTABLE_PATH || (await chromium.executablePath('/var/task/node_modules/@sparticuz/chromium/bin')),

Calling the function did:

executablePath: process.env.CHROME_EXECUTABLE_PATH || (await await chromium.executablePath()),

by blackspike design

About

A demo project showing puppeteer working on netlify functions

Resources

Stars

Watchers

Forks

Packages

No packages published