Prerequisites
- A project with Trigger.dev initialized
- Puppeteer installed:
npm install puppeteer
Build configuration
Add the Puppeteer build extension to yourtrigger.config.ts:
trigger.config.ts
Set the executable path
Add the following environment variable in your Trigger.dev dashboard:Example 1: Log a page title
The simplest Puppeteer task — opens a browser, navigates to a URL, and logs the page title.trigger/puppeteer-basic-example.ts
Example 2: Generate a PDF from a web page
This task opens a web page, generates a PDF, and uploads it to Cloudflare R2.trigger/puppeteer-generate-pdf.ts
Example 3: Scrape content from a web page
This task uses Puppeteer with a BrowserBase proxy to scrape the GitHub stars count from the Trigger.dev landing page.trigger/scrape-website.ts
Proxy services
If you are using Trigger.dev Cloud and scraping content from websites you don’t own, use one of these proxy services withbrowserWSEndpoint:
Local development
When running locally withtrigger.dev dev, the Puppeteer build extension is not applied. You need
Chrome or Chromium installed locally. Puppeteer will automatically download a compatible Chromium
build when you run npm install puppeteer.