Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 68 additions & 6 deletions src/content/docs/browser-rendering/platform/limits.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:
order: 30
---

import { Render, Plan, DashButton } from "~/components";
import { Render, Plan, Tabs, TabItem, DashButton } from "~/components";

<Plan type="workers-all" />

Expand Down Expand Up @@ -57,11 +57,7 @@ By default, a browser will time out if it does not get any [devtools](https://ch

While the limits above define the maximum number of concurrent browser sessions per account, in practice you may not need to hit these limits. Browser sessions close automatically—by default, after 60 seconds of inactivity or upon task completion—so if each session finishes its work before a new request comes in, the effective concurrency is lower. This means that most workflows do not require very high concurrent browser limits.

## FAQ

### I upgraded from the Workers Free plan, but I'm still hitting the 10-minute per day limit. What should I do?

If you recently upgraded to the [Workers Paid plan](/workers/platform/pricing/) but still encounter the 10-minute per day limit, redeploy your Worker to ensure your usage is correctly associated with the new plan.
## Limits FAQ & troubleshooting

To upgrade, go to the **Compute (Workers) > Workers plans** page in the Cloudflare dashboard:

Expand All @@ -80,4 +76,70 @@ By default, a browser instance will time out after 60 seconds of inactivity. If

There is no fixed maximum lifetime for a browser session as long as it remains active. By default, a browser will close after one minute of inactivity, but you can [extend this inactivity window](#can-i-increase-the-browser-timeout). Sessions will also be closed when Browser Rendering rolls out a new release.

### I upgraded from the Workers Free plan, but I'm still hitting the 10-minute per day limit. What should I do?

If you recently upgraded to the [Workers Paid plan](/workers/platform/pricing/) but still encounter the 10-minute per day limit, redeploy your Worker to ensure your usage is correctly associated with the new plan.

### Error: `429 Too Many Requests`

When you make too many requests in a short period of time, Browser Rendering will respond with HTTP status code `429 Too Many Requests`.
The response includes a `Retry-After` header, which specifies how many seconds to wait before retrying. You can view your account's rate limits on the [Limits](/browser-rendering/platform/limits/) page.

The example below demonstrates how to handle rate limiting gracefully by reading the `Retry-After` value and retrying the request after that delay.

<Tabs syncKey="workersExamples"> <TabItem label="REST API">
```js
const response = await fetch('https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/content', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your-token>',
},
body: JSON.stringify({ url: 'https://example.com' })
});

if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After');
console.log(`Rate limited. Waiting ${retryAfter} seconds...`);
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));

// Retry the request
const retryResponse = await fetch(/* same request as above */);
}
```

</TabItem> <TabItem label="Workers Bindings">

```js
import puppeteer from "@cloudflare/puppeteer";

try {
const browser = await puppeteer.launch(env.MYBROWSER);

const page = await browser.newPage();
await page.goto("https://example.com");
const content = await page.content();

await browser.close();
} catch (error) {
if (error.status === 429) {
const retryAfter = error.headers.get("Retry-After");
console.log(
`Browser instance limit reached. Waiting ${retryAfter} seconds...`,
);
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));

// Retry launching browser
const browser = await puppeteer.launch(env.MYBROWSER);
}
}
```

</TabItem> </Tabs>

### Error: `Error processing the request: Unable to create new browser: code: 429: message: Browser time limit exceeded for today`

This error indicates you have hit the daily browser-instance limit on the Workers Free plan. [Free-plan accounts are capped at free plan limit is 10 minutes of browser use a day](/browser-rendering/platform/limits/#workers-free) once you exceed those, further creation attempts return a 429 until the next UTC day.

To resolve: [Upgrade to a Workers Paid plan](/workers/platform/pricing/) which allows for more than 10 minutes of usage a day and has higher [limits](/browser-rendering/platform/limits/#workers-paid). If you recently upgraded but still see this error, try redeploying your Worker to ensure your usage is correctly associated with your new plan.

4 changes: 2 additions & 2 deletions src/content/docs/browser-rendering/platform/pricing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ For **concurrent browsers**:
For **browser duration** and **concurrent browsers**:
<br/>$3.60 + $10.00 = $13.60

## FAQ
## Pricing FAQ

### How do I estimate my Browser Rendering costs?

Expand All @@ -50,7 +50,7 @@ You can monitor Browser Rendering usage in two ways:

<DashButton url="/?to=/:account/workers/browser-rendering" />

- The `X-Browser-Ms-Used` header, which is returned in every REST API response, reports browser time used for the request (in milliseconds). You can also access this header using the Typescript SDK with the .asResponse() method:
- The `X-Browser-Ms-Used` header, which is returned in every REST API response, reports browser time used for the request (in milliseconds). You can also access this header using the Typescript SDK with the .asResponse() method:

```ts
const contentRes = await client.browserRendering.content.create({
Expand Down