Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/browser-rendering/configuration.md
1# Configuration & Setup23## Installation45```bash6npm install @cloudflare/puppeteer # or @cloudflare/playwright7```89**Use Cloudflare packages** - standard `puppeteer`/`playwright` won't work in Workers.1011## wrangler.json1213```json14{15"name": "browser-worker",16"main": "src/index.ts",17"compatibility_date": "2025-01-01",18"compatibility_flags": ["nodejs_compat"],19"browser": {20"binding": "MYBROWSER"21}22}23```2425**Required:** `nodejs_compat` flag and `browser.binding`.2627## TypeScript2829```typescript30interface Env {31MYBROWSER: Fetcher;32}3334export default {35async fetch(request: Request, env: Env): Promise<Response> {36// ...37}38} satisfies ExportedHandler<Env>;39```4041## Development4243```bash44wrangler dev --remote # --remote required for browser binding45```4647**Local mode does NOT support Browser Rendering** - must use `--remote`.4849## REST API5051No wrangler config needed. Get API token with "Browser Rendering - Edit" permission.5253```bash54curl -X POST \55'https://api.cloudflare.com/client/v4/accounts/{accountId}/browser-rendering/screenshot' \56-H 'Authorization: Bearer TOKEN' \57-d '{"url": "https://example.com"}' --output screenshot.png58```5960## Requirements6162| Requirement | Value |63|-------------|-------|64| Node.js compatibility | `nodejs_compat` flag |65| Compatibility date | 2023-03-01+ |66| Module format | ES modules only |67| Browser | Chromium 119+ (no Firefox/Safari) |6869**Not supported:** WebGL, WebRTC, extensions, `file://` protocol, Service Worker syntax.7071## Troubleshooting7273| Error | Solution |74|-------|----------|75| `MYBROWSER is undefined` | Use `wrangler dev --remote` |76| `nodejs_compat not enabled` | Add to `compatibility_flags` |77| `Module not found` | `npm install @cloudflare/puppeteer` |78| `Browser Rendering not available` | Enable in dashboard |79