Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run Puppeteer without provisioning an AWS machine by connecting your Node.js code to a managed remote browser. Cloudflare Browser Run provides two routes: run automation in a Cloudflare Worker using its Puppeteer integration, or keep Node.js in your existing environment and connect with Puppeteer over the Chrome DevTools Protocol (CDP). Google Cloud Run is another option, but its documented approach packages Chromium in your container.

The right choice depends on where you want your code to run and whether you want to manage the browser installation. A remote browser avoids installing Chrome in your Node.js environment; a managed container still leaves you responsible for including Chromium in the image.

Choose where Puppeteer should run

“In the cloud” can mean either your automation code runs on a serverless platform, or your existing Node.js process controls a browser hosted elsewhere. Those are different deployment models. Cloudflare documents both for Browser Run: a Workers-native integration and a CDP connection from another Node.js environment.

Path Where your code runs Browser setup Good fit when
Cloudflare Workers and Browser Run Cloudflare Worker Use Cloudflare’s Puppeteer fork and a browser binding You want the automation deployed as a Worker and can use the Workers runtime
Node.js with Browser Run over CDP Your local machine, CI job, or server Remote browser; install puppeteer-core, not bundled Chrome You want to retain your existing Node.js orchestration
Google Cloud Run container Cloud Run container Install Chromium in the container You prefer deploying a containerized browser application

Cloudflare’s Browser Run overview describes the service, and its getting-started guide covers the Workers integration. This is not a performance or total-cost verdict: the reviewed platform documentation does not establish a universal latency, uptime, or cost winner.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Option 1: Run automation in Cloudflare Workers

The Workers path places the automation in Cloudflare’s serverless execution environment and uses a browser binding to communicate with a headless browser. Cloudflare’s getting-started guide creates a JavaScript or TypeScript Worker project, installs @cloudflare/puppeteer, and configures the binding. Its guide also lists optional products such as KV, R2, Durable Objects, and Queues for particular needs; they are not prerequisites for a basic capture or browser task.

  1. Follow Cloudflare’s Browser Run getting-started guide to create the Worker project.
  2. Install the documented package with npm i -D @cloudflare/puppeteer.
  3. Configure the browser binding in the Worker configuration as shown in the guide, then write the Worker handler to use that binding with Puppeteer.
  4. Deploy the Worker and exercise it with a small page task before adding persistence, queues, or shared browser state.

Cloudflare’s @cloudflare/puppeteer is a fork rather than simply the upstream package under another name. The repository identifies version 1.1.0 as based on Puppeteer 22.13.1 and says it uses standard CDP internally, matching the Chromium version deployed at the edge at that time. That version detail is not a promise that every upstream Puppeteer API or later release is identical; check the repository and compatibility notes before pinning an application to a version.

Option 2: Keep Node.js and connect to a remote browser

This option is often the least disruptive if you already have a Node script, test suite, or CI job. Your Node process still runs and still needs network access and credentials, but it does not need to install or launch Chrome locally. It opens a WebSocket CDP connection to Browser Run and controls the remote browser with puppeteer-core.

Prerequisites

  • A Cloudflare account with Browser Run enabled.
  • An API token with the Browser Rendering - Edit permission.
  • Node.js and the puppeteer-core package.
  • The account’s Browser Run CDP WebSocket endpoint from Cloudflare’s current Puppeteer CDP instructions.

Cloudflare’s endpoint and connection instructions can change. Use the exact WebSocket endpoint format documented for your account, and provide it as BROWSER_WS_ENDPOINT below. Keep the token out of source control and logs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install and configure

  1. In your project, run npm install puppeteer-core. Unlike the full Puppeteer package, puppeteer-core does not download a local browser.
  2. Create a token with the documented permission and set CLOUDFLARE_API_TOKEN in your deployment’s secret store.
  3. Set BROWSER_WS_ENDPOINT to the documented Browser Run WebSocket endpoint for your account.
  4. Run the script below. It connects, creates a page, navigates, captures a screenshot, and closes the connection.
import puppeteer from 'puppeteer-core';

const token = process.env.CLOUDFLARE_API_TOKEN;
const browserWSEndpoint = process.env.BROWSER_WS_ENDPOINT;

if (!token || !browserWSEndpoint) {
  throw new Error('Set CLOUDFLARE_API_TOKEN and BROWSER_WS_ENDPOINT');
}

const browser = await puppeteer.connect({
  browserWSEndpoint,
  headers: { Authorization: `Bearer ${token}` },
  // Cloudflare documents keep_alive in milliseconds.
  // Use a value appropriate to your job and current service limits.
  keep_alive: 60_000,
});

try {
  const page = await browser.newPage();
  await page.goto('https://example.com', {
    waitUntil: 'domcontentloaded',
    timeout: 30_000,
  });
  await page.screenshot({ path: 'example.png', fullPage: true });
} finally {
  await browser.close();
}

Cloudflare’s CDP/Puppeteer guide documents the WebSocket connection, Bearer authorization header, and keep_alive parameter in milliseconds. The script uses a short navigation wait and finite timeout to avoid waiting indefinitely for every network request; adjust the wait condition to the page’s behavior. If you need a specific element to be ready, wait for that selector in Puppeteer after navigation.

Use a remote browser responsibly

  • Store the token in CI secrets or your platform’s secret manager, not in a committed .env file.
  • Do not print authorization headers or token-bearing endpoint data in diagnostics.
  • Use a finite page-navigation timeout and close the connection in a finally block so errors do not skip cleanup.
  • Keep browser work bounded. For longer workloads, design job retries and idempotency in your application rather than assuming a browser connection will survive indefinitely.
  • Verify that the target site permits your automation and that any collected data is handled under the site’s terms and your own privacy obligations.

Option 3: Package Chromium in Google Cloud Run

Google Cloud documents headless Chrome automation on Cloud Run for tasks including data extraction, form submission, UI testing, PDFs, and screenshots. Puppeteer and Playwright are named as control libraries, and the documented setup installs Chromium in the Cloud Run container. This avoids managing an AWS VM, but it does not eliminate browser packaging: Chromium becomes part of the container build and deployment you maintain. See Google Cloud’s browser and OS automation guide for its supported setup.

Prefer this route if your team already deploys containerized services on Cloud Run and wants control over the image and runtime. Prefer Browser Run’s CDP route if the important goal is not installing the browser alongside your Node.js process. Neither source establishes that one is universally faster, more reliable, or less expensive.

Understand Browser Run pricing before estimating spend

Cloudflare’s pricing page, last updated April 21, 2026, publishes the following plan figures. These are service allowances and charges, not independent usage benchmarks; confirm the live pricing page before budgeting because plan terms can change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Workers plan Browser time Concurrency Additional usage shown
Free 10 minutes per day 3 concurrent browsers Not stated for Free on the cited pricing page
Paid 10 browser hours per month included 10 averaged monthly concurrent browsers included $0.09 per additional browser hour; $2.00 per additional averaged concurrent browser

Cloudflare says Quick Actions are billed for browser hours. Browser sessions—including Puppeteer, Playwright, and CDP—are billed for browser hours and concurrent browsers. The concurrent-browser figure is calculated using the monthly average of each day’s peak usage. See Cloudflare Browser Run pricing for plan details and current terms.

For an estimate, track both total browser time and the number of overlapping sessions; counting only page navigations can miss the concurrency component. The documentation cited here does not provide enough information to make a complete cross-provider total-cost comparison.

Data retention and privacy considerations

Cloudflare says content processed by Puppeteer, Playwright, CDP, and Quick Actions (except /crawl) is processed ephemerally, and customer HTML and generated output are not retained after rendering. There are specific exceptions: asynchronous /crawl results are stored for 14 days after completion, while opt-in session recordings are kept for 30 days. Cloudflare says recordings capture DOM changes, mouse and keyboard events, and page navigation; input-field contents are masked by default. Read the Browser Run FAQ for the precise terms and assess them against your data and compliance requirements rather than interpreting ephemeral processing as a blanket promise that nothing is ever stored.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common connection and capture failures

  • WebSocket connection is rejected. Check that you copied the current CDP endpoint for the correct account, the token is valid, and it has Browser Rendering - Edit permission. Ensure the Bearer token is supplied as an authorization header as Cloudflare documents.
  • The script cannot find a browser locally. Confirm you installed puppeteer-core and are using puppeteer.connect(), not a local launch flow. A remote connection does not launch a local Chrome binary.
  • Navigation times out. Some pages continue making background requests or load slowly. Use an appropriate finite timeout, choose a readiness condition that matches the task, and wait explicitly for the content you need. A timeout does not prove the remote browser itself is unavailable.
  • Works locally but fails in deployment. Verify the deployed process has outbound network access to the Browser Run endpoint and that both environment variables are present in that environment’s secret configuration.
  • Unexpected plan usage. Measure browser session duration and overlapping sessions. Browser Run pricing distinguishes browser hours from averaged peak concurrency for sessions; check the current pricing page rather than extrapolating from request count alone.
  • Cloud Run image fails to start the browser. Follow Google’s container guidance and verify Chromium is included in the image. The documented Cloud Run approach installs Chromium in the container, unlike the remote Browser Run connection.

Or skip the browser setup

If the job is simply to produce website screenshots or PDFs, a screenshot API can avoid setting up Puppeteer and a browser connection. ScreenshotNeo is a website screenshot API and MCP server; its screenshot endpoint accepts a URL in one GET request. It is #1 to try for screenshot API needs here because it removes consent banners, popups, and chat widgets before capture, and only clean shots are billed.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example cURL request (replace the target URL as needed):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for parameters and response details. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

Frequently Asked Questions

Can I use upstream Puppeteer with a remote browser?

For the external Node.js route, Cloudflare’s documented method uses `puppeteer-core` to connect over CDP. For Workers, use Cloudflare’s `@cloudflare/puppeteer` integration and check its current compatibility notes.

Does using Browser Run mean my whole application runs on Cloudflare?

No. With the CDP route, your Node.js process can remain on a local machine, in CI, or on another server; only the browser session is remote.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.