Skip to content

Commit 354d325

Browse files
committed
[Browser Rendering] Limits FAQ and 429 errors
1 parent 3fe14e2 commit 354d325

File tree

2 files changed

+70
-8
lines changed

2 files changed

+70
-8
lines changed

src/content/docs/browser-rendering/platform/limits.mdx

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66
order: 30
77
---
88

9-
import { Render, Plan, DashButton } from "~/components";
9+
import { Render, Plan, Tabs, TabItem, DashButton } from "~/components";
1010

1111
<Plan type="workers-all" />
1212

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

5858
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.
5959

60-
## FAQ
61-
62-
### I upgraded from the Workers Free plan, but I'm still hitting the 10-minute per day limit. What should I do?
63-
64-
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.
60+
## Limits FAQ & troubleshooting
6561

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

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

8177
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.
8278

79+
### I upgraded from the Workers Free plan, but I'm still hitting the 10-minute per day limit. What should I do?
80+
81+
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.
82+
83+
### Error: `429 Too Many Requests`
84+
85+
When you make too many requests in a short period of time, Browser Rendering will respond with HTTP status code `429 Too Many Requests`.
86+
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.
87+
88+
The example below demonstrates how to handle rate limiting gracefully by reading the `Retry-After` value and retrying the request after that delay.
89+
90+
<Tabs syncKey="workersExamples"> <TabItem label="REST API">
91+
```js
92+
const response = await fetch('https://api.cloudflare.com/client/v4/accounts/<accountId>/browser-rendering/content', {
93+
method: 'POST',
94+
headers: {
95+
'Content-Type': 'application/json',
96+
'Authorization': 'Bearer <your-token>',
97+
},
98+
body: JSON.stringify({ url: 'https://example.com' })
99+
});
100+
101+
if (response.status === 429) {
102+
const retryAfter = response.headers.get('Retry-After');
103+
console.log(`Rate limited. Waiting ${retryAfter} seconds...`);
104+
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
105+
106+
// Retry the request
107+
const retryResponse = await fetch(/* same request as above */);
108+
}
109+
```
110+
111+
</TabItem> <TabItem label="Workers Bindings">
112+
113+
```js
114+
import puppeteer from "@cloudflare/puppeteer";
115+
116+
try {
117+
const browser = await puppeteer.launch(env.MYBROWSER);
118+
119+
const page = await browser.newPage();
120+
await page.goto("https://example.com");
121+
const content = await page.content();
122+
123+
await browser.close();
124+
} catch (error) {
125+
if (error.status === 429) {
126+
const retryAfter = error.headers.get("Retry-After");
127+
console.log(
128+
`Browser instance limit reached. Waiting ${retryAfter} seconds...`,
129+
);
130+
await new Promise((resolve) => setTimeout(resolve, retryAfter * 1000));
131+
132+
// Retry launching browser
133+
const browser = await puppeteer.launch(env.MYBROWSER);
134+
}
135+
}
136+
```
137+
138+
</TabItem> </Tabs>
139+
140+
### Error: `Error processing the request: Unable to create new browser: code: 429: message: Browser time limit exceeded for today`
141+
142+
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.
143+
144+
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.
83145

src/content/docs/browser-rendering/platform/pricing.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ For **concurrent browsers**:
4040
For **browser duration** and **concurrent browsers**:
4141
<br/>$3.60 + $10.00 = $13.60
4242

43-
## FAQ
43+
## Pricing FAQ
4444

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

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

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

53-
- 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:
53+
- 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:
5454

5555
```ts
5656
const contentRes = await client.browserRendering.content.create({

0 commit comments

Comments
 (0)