Test OpenGraph image generation on Netlify locally
02 Jun 2021 in Tech
I previously wrote a post on how to generate OpenGraph images with Netlify on-demand builders.
Kevin tried it out but was frustrated that it was tough to test locally.
Here's how to develop on your local machine:
- Install
chromium
withbrew
bash
brew install --cask chromium
- Install
netlify-cli
bash
npm install netlify-cli -g
- Update
executablePath
in the call topuppeteer.launch
javascript
executablePath: process.env.CHROMIUM_PATH || (await chromium.executablePath),
Run
CHROMIUM_PATH=/usr/local/bin/chromium netlify dev
in your terminalVisit http://localhost:8888/.netlify/functions/og to see a generated image
Enjoy your generated image