You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature: optional batch upload for faster R2 cache population
6
+
7
+
This update adds optional batch upload support for R2 cache population, significantly improving upload performance for large caches when enabled via .env or environment variables.
8
+
9
+
**Key Changes:**
10
+
11
+
1.**Optional Batch Upload**: Configure R2 credentials via .env or environment variables to enable faster batch uploads:
12
+
13
+
-`R2_ACCESS_KEY_ID`
14
+
-`R2_SECRET_ACCESS_KEY`
15
+
-`CF_ACCOUNT_ID`
16
+
17
+
2.**Automatic Detection**: When credentials are detected, batch upload is automatically used for better performance
18
+
19
+
3.**Smart Fallback**: If credentials are not configured, the CLI falls back to standard Wrangler uploads with a helpful message about enabling batch upload for better performance
20
+
21
+
**All deployment commands support batch upload:**
22
+
23
+
-`populateCache` - Explicit cache population
24
+
-`deploy` - Deploy with cache population
25
+
-`upload` - Upload version with cache population
26
+
-`preview` - Preview with cache population
27
+
28
+
**Performance Benefits (when batch upload is enabled):**
29
+
30
+
- Parallel transfer capabilities (32 concurrent transfers)
31
+
- Significantly faster for large caches
32
+
- Reduced API calls to Cloudflare
33
+
34
+
**Usage:**
35
+
36
+
Add the credentials in a `.env`/`.dev.vars` file in your project root:
37
+
38
+
```bash
39
+
R2_ACCESS_KEY_ID=your_key
40
+
R2_SECRET_ACCESS_KEY=your_secret
41
+
CF_ACCOUNT_ID=your_account
42
+
```
43
+
44
+
You can also set the environment variables for CI builds.
45
+
46
+
**Note:**
47
+
48
+
You can follow documentation https://developers.cloudflare.com/r2/api/tokens/ for creating API tokens with appropriate permissions for R2 access.
Copy file name to clipboardExpand all lines: packages/cloudflare/README.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,3 +55,30 @@ Deploy your application to production with the following:
55
55
# or
56
56
bun opennextjs-cloudflare build && bun opennextjs-cloudflare deploy
57
57
```
58
+
59
+
### Batch Cache Population (Optional, Recommended)
60
+
61
+
For improved performance with large caches, you can enable batch upload by providing R2 credentials via .env or environment variables.
62
+
63
+
Create a `.env` file in your project root (automatically loaded by the CLI):
64
+
65
+
```bash
66
+
R2_ACCESS_KEY_ID=your_access_key_id
67
+
R2_SECRET_ACCESS_KEY=your_secret_access_key
68
+
CF_ACCOUNT_ID=your_account_id
69
+
```
70
+
71
+
You can also set the environment variables for CI builds.
72
+
73
+
**Note:**
74
+
75
+
You can follow documentation https://developers.cloudflare.com/r2/api/tokens/ for creating API tokens with appropriate permissions for R2 access.
76
+
77
+
**Benefits:**
78
+
79
+
- Significantly faster uploads for large caches using parallel transfers
80
+
- Reduced API calls to Cloudflare
81
+
- Automatically enabled when credentials are provided
82
+
83
+
**Fallback:**
84
+
If these environment variables are not set, the CLI will use standard Wrangler uploads. Both methods work correctly - batch upload is simply faster for large caches.
0 commit comments