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
chromiumwithbrew
bashbrew install --cask chromium
- Install
netlify-cli
bashnpm install netlify-cli -g
- Update
executablePathin the call topuppeteer.launch
javascriptexecutablePath: process.env.CHROMIUM_PATH || (await chromium.executablePath),
Run
CHROMIUM_PATH=/usr/local/bin/chromium netlify devin your terminalVisit http://localhost:8888/.netlify/functions/og to see a generated image
Enjoy your generated image