From b0351a0af3ab9008a9670db963b83742960eb43c Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Mon, 3 Nov 2025 10:52:45 +0100 Subject: [PATCH] docs(cloudflare): Document how to enable R2 cache batch uploads --- pages/cloudflare/cli.mdx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pages/cloudflare/cli.mdx b/pages/cloudflare/cli.mdx index 264680f..a3c9d5a 100644 --- a/pages/cloudflare/cli.mdx +++ b/pages/cloudflare/cli.mdx @@ -22,6 +22,12 @@ It first builds the Next.js application by invoking the `build` script of the `p It populates the configured [Open Next cache components](/cloudflare/caching) so that caching works at runtime. It can populate the local bindings (`populateCache local`) used during development on your local machine or the remote bindings (`populateCache remote`) used by the deployed application. Note that this command is implicitly called by the `preview`, `deploy`, and `upload` commands so there is no need to explicitly call `populateCache` when one of those is used. +The `populateCache` command supports R2 batching to speed up the upload of large number of files. To enable R2 batching, you need to create an R2 Account API token as described [in the docs](https://developers.cloudflare.com/r2/api/tokens/) and provide the following environment variables: + +- `R2_ACCESS_KEY_ID`: The access key ID of the R2 API token +- `R2_SECRET_ACCESS_KEY`: The secret access key of the R2 API token +- `CLOUDFLARE_ACCOUNT_ID`: The [account ID](https://developers.cloudflare.com/fundamentals/account/find-account-and-zone-ids/#copy-your-account-id) where the R2 bucket is located + ### `preview` command It starts by populating the local cache and then launches a local development server (via `wrangler dev`) so that you can preview the application locally.