Skip to main content
BrowserlessProvider offloads page rendering to a running Browserless instance over its REST API. Instead of managing a local Chromium process, GitResolve sends a POST /content request to the Browserless server and receives back the fully rendered HTML. The provider itself is entirely stateless — there is no browser lifecycle to manage, no process to terminate, and cleanup() is a no-op.

When to use

  • Production servers where installing a full browser binary is undesirable or against policy
  • CI/CD pipelines that run Browserless as a sidecar container alongside your test runner
  • Restricted environments such as read-only filesystems or minimal base images that cannot host a Chromium install
  • Shared rendering infrastructure where a single Browserless instance serves multiple GitResolve workers

Docker setup

Start a Browserless container before running GitResolve:
The container exposes its REST API on port 3000 by default. GitResolve will connect to http://localhost:3000 unless you specify a different address.

Configuration

BrowserlessProvider resolves its base URL from three sources, checked in this order:

Usage

Direct instantiation

Pass an explicit URL to target a non-default instance:

Via the factory

CLI

To use BrowserlessProvider from the command line, set the BROWSER_PROVIDER and BROWSERLESS_URL environment variables:

How it works

1

POST to /content

getPageContent sends a POST request to {baseUrl}/content with a JSON body containing the target url and gotoOptions (waitUntil and timeout). Browserless navigates to the URL inside a managed Chromium instance and returns the fully rendered HTML.
2

Response handling

If the Browserless server returns a 2xx status, GitResolve reads the response body as text and returns it. A non-2xx response throws Error: Browserless /content returned <status>: <statusText> <body>.
3

Availability check

isAvailable() performs a GET {baseUrl}/json/version with a 3-second timeout. If the server responds with a 2xx status, the provider is considered available. Any network error or non-2xx response returns false.
4

Cleanup (no-op)

Because Browserless is a stateless REST service — it manages its own browser pool internally — cleanup() does nothing. There are no local resources to release.

Options

cleanup() is a no-op for BrowserlessProvider. Calling it is safe and idiomatic, but it performs no work — the Browserless container manages its own Chromium lifecycle independently.