Last verified: 2026-02-20 · Source
Serverless screenshots for Puppeteer workflows
Already using Puppeteer? Offload screenshot-only operations to Scrnpix API. Reduce browser instance overhead and speed up CI/CD pipelines.
Puppeteer + Scrnpix Hybrid Approach
Use Puppeteer for complex interactions, Scrnpix for simple screenshots:
curl "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1920&height=1080&format=png" \ -H "X-KEY: your-api-key" \ -o quick-screenshot.png
curl "https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=5&frame_delay=100" \ -H "X-KEY: your-api-key" \ -o scroll-animation.gif
CI Response Handling
Handle API responses alongside your Puppeteer scripts:
| Status | Description |
|---|---|
| 200 OK | Success. Response body is image buffer. Use fs.writeFileSync() or pipe directly to comparison. |
| 400 Bad Request | Invalid parameters. Validate url and dimensions before calling. Log response.text() for details. |
| 401 Unauthorized | API key missing or invalid. Use process.env.API_KEY and verify CI secrets configuration. |
| 408 Timeout | Target page slow to load. Unlike Puppeteer, you can't extend timeout—retry or check URL. |
| 5xx Server Error | Service error. Use node-fetch-retry or implement async retry wrapper with 3 attempts. |
Key Features
Reduce Infrastructure Load
Run Puppeteer for complex automation, use Scrnpix API for simple screenshots. Reduce Chrome instance overhead in CI/CD pipelines.
Same Chrome Engine
Both Scrnpix and Puppeteer use Chromium. Consistent rendering across your screenshot captures and automation scripts.
Scrolling GIFs
Puppeteer requires custom scroll code for animations. Scrnpix provides built-in scroll animations with easing functions via API.
Serverless Deployment
No need to deploy Puppeteer to Lambda/Cloud Functions for screenshots. Use Scrnpix API instead and avoid bundling Chrome binaries.
Frequently Asked Questions
Should I replace Puppeteer with Scrnpix?
No. Use Puppeteer for complex browser automation (forms, clicks, scraping). Use Scrnpix for simple URL-to-screenshot conversions. They complement each other.
Can Scrnpix handle pages requiring JavaScript interaction?
Scrnpix waits for page load but doesn't support custom interactions. Use Puppeteer to navigate/interact, then either screenshot with Puppeteer or pass the final URL to Scrnpix.
How do I create scrolling GIFs with Puppeteer?
Manually: write scroll loops and capture frames. Easier: use Scrnpix's /animate endpoint with scroll_duration and easing parameters. It handles frame capture and GIF encoding.
Does Scrnpix work in CI like GitHub Actions?
Yes. No browser installation needed. Just HTTP requests. Faster than installing Puppeteer + Chromium in CI environments.
Simplify your Puppeteer workflow
Use Scrnpix for simple screenshots, save Puppeteer for complex automation. Reduce CI overhead and deployment complexity.
Get Started