Skip to content

Commit 3ba9a14

Browse files
Apply suggestions from code review
Co-authored-by: Aviv Keller <me@aviv.sh> Signed-off-by: Dario Piotrowicz <dario.piotrowicz@gmail.com>
1 parent c8305a3 commit 3ba9a14

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

docs/cloudflare-build-and-deployment.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Node.js Website can be built using the [OpenNext Cloudflare adapter](https:/
44

55
## Configurations
66

7-
There are two key configuration files related to Cloudflare deployments.
7+
There are two key configuration files related to Cloudflare deployments:
88

99
### Wrangler Configuration
1010

@@ -16,30 +16,34 @@ Key configurations include:
1616

1717
- `main`: Points to the worker generated by the OpenNext adapter.
1818
- `account_id`: Specifies the Cloudflare account ID. This is not required for local previews but is necessary for deployments. You can obtain an account ID for free by signing up at [dash.cloudflare.com](https://dash.cloudflare.com/login).
19-
- This is currently set to `fb4a2d0f103c6ff38854ac69eb709272` which is the id of a Cloudflare account, named `nodejs.org`, that the nodejs team is using for testing the Cloudflare deployment.
20-
- `build`: Defines the build command to generate Node.js filesystem polyfills required for the application to run on Cloudflare Workers. This uses the [`@flarelabs/wrangler-build-time-fs-assets-polyfilling`](https://github.com/flarelabs-net/wrangler-build-time-fs-assets-polyfilling) package.
19+
- This is currently set to `fb4a2d0f103c6ff38854ac69eb709272`, which is the ID of a Cloudflare account controlled by Node.js, and used for testing.
20+
- `build`: Defines the build command to generate the Node.js filesystem polyfills required for the application to run on Cloudflare Workers. This uses the [`@flarelabs/wrangler-build-time-fs-assets-polyfilling`](https://github.com/flarelabs-net/wrangler-build-time-fs-assets-polyfilling) package.
2121
- `alias`: Maps aliases for the Node.js filesystem polyfills generated during the build process.
2222
- `kv_namespaces`: Contains a single KV binding definition for `NEXT_INC_CACHE_KV`. This is used to implement the Next.js incremental cache.
23-
- This is currently set up to a KV in the `nodejs.org` Cloudflare testing account.
23+
- This is currently set up to a KV in the aforementioned Cloudflare testing account.
2424

2525
### OpenNext Configuration
2626

27-
This is the configuration for the OpenNext Cloudflare adapter, for more details on such configuration please refer to the [official OpenNext documentation](https://opennext.js.org/cloudflare/get-started#4-add-an-open-nextconfigts-file).
27+
This is the configuration for the OpenNext Cloudflare adapter.
28+
29+
For more details, refer to the [official OpenNext documentation](https://opennext.js.org/cloudflare/get-started#4-add-an-open-nextconfigts-file).
2830

2931
### Skew Protection
3032

31-
While Vercel offers [version skew protection](https://vercel.com/docs/skew-protection) out of the box, such mechanism is not present on the platform level in the Cloudflare network and the Open-next adapter provides its own implementation, for more details refer to the [OpenNext official Skew protection documentation](https://opennext.js.org/cloudflare/howtos/skew).
33+
While Vercel offers [version skew protection](https://vercel.com/docs/skew-protection) out of the box, such mechanism is not present on the platform level in the Cloudflare network.
34+
35+
Therefore, the OpenNext adapter provides its [own implementation](https://opennext.js.org/cloudflare/howtos/skew).
3236

3337
The OpenNext skew protection requires the following environment variables to be set in the Wrangler configuration file:
3438

3539
- `CF_WORKER_NAME`
3640
- The name of the worker (the same as `name`)
3741
- `CF_ACCOUNT_ID`
38-
- The id of the Cloudflare account (this is the same as `account_id`, and again this is set to the Cloudflare testing account used by the nodejs team)
42+
- The ID of the Cloudflare account (the same as `account_id`)
3943
- `CF_PREVIEW_DOMAIN`
40-
- The preview domain for the worker, given that the preview url for the testing Cloudflare deployments is `https://nodejs-website.nodejsorg.workers.dev/` the domain here is `nodejsorg`
44+
- The preview domain for the worker. For Node.js, this is `nodejsorg`.
4145

42-
Additionally upon deployments an extra `CF_WORKERS_SCRIPTS_API_TOKEN` environment variable needs to be set. This variable needs to be set to an API token that has the `Workers Scripts:Read` permission available on the worker's account.
46+
Additionally, when deploying, an extra `CF_WORKERS_SCRIPTS_API_TOKEN` environment variable needs to be set to an API token that has the `Workers Scripts:Read` permission available on the Worker's account.
4347

4448
## Scripts
4549

0 commit comments

Comments
 (0)