File tree Expand file tree Collapse file tree 5 files changed +195
-23
lines changed
Expand file tree Collapse file tree 5 files changed +195
-23
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2+ import { getDeploymentId } from '@opennextjs/cloudflare' ;
23import createNextIntlPlugin from 'next-intl/plugin' ;
34
45import { BASE_PATH , ENABLE_STATIC_EXPORT } from './next.constants.mjs' ;
@@ -95,6 +96,9 @@ const nextConfig = {
9596 'shiki' ,
9697 ] ,
9798 } ,
99+ // If we're building for the Cloudflare deployment we want to set
100+ // an appropriate deploymentId (needed for skew protection)
101+ deploymentId : process . env . CLOUDFLARE ? getDeploymentId ( ) : undefined ,
98102} ;
99103
100104const withNextIntl = createNextIntlPlugin ( './i18n.tsx' ) ;
Original file line number Diff line number Diff line change 1+ import type { OpenNextConfig } from '@opennextjs/cloudflare' ;
12import { defineCloudflareConfig } from '@opennextjs/cloudflare' ;
23import incrementalCache from '@opennextjs/cloudflare/overrides/incremental-cache/kv-incremental-cache' ;
34
45const cloudflareConfig = defineCloudflareConfig ( { incrementalCache } ) ;
56
6- export default { ...cloudflareConfig , buildCommand : 'pnpm build:default' } ;
7+ const openNextConfig : OpenNextConfig = {
8+ ...cloudflareConfig ,
9+ buildCommand : 'pnpm build:default' ,
10+ cloudflare : {
11+ skewProtection : {
12+ enabled : true ,
13+ } ,
14+ } ,
15+ } ;
16+
17+ export default openNextConfig ;
Original file line number Diff line number Diff line change 77 "build:blog-data" : " cross-env NODE_NO_WARNINGS=1 node ./scripts/blog-data/generate.mjs" ,
88 "build:blog-data:watch" : " node --watch --watch-path=pages/en/blog ./scripts/blog-data/generate.mjs" ,
99 "build:default" : " cross-env NODE_NO_WARNINGS=1 next build" ,
10- "cloudflare:build:worker" : " opennextjs-cloudflare build" ,
10+ "cloudflare:build:worker" : " CLOUDFLARE=true opennextjs-cloudflare build" ,
1111 "cloudflare:deploy" : " wrangler deploy" ,
1212 "cloudflare:preview" : " wrangler dev" ,
1313 "predeploy" : " node --run build:blog-data" ,
8080 "@eslint/eslintrc" : " ~3.3.1" ,
8181 "@flarelabs-net/wrangler-build-time-fs-assets-polyfilling" : " ^0.0.0" ,
8282 "@next/eslint-plugin-next" : " 15.3.4" ,
83- "@opennextjs/cloudflare" : " ^1.3.0 " ,
83+ "@opennextjs/cloudflare" : " ^1.5.1 " ,
8484 "@playwright/test" : " ^1.53.2" ,
8585 "@testing-library/user-event" : " ~14.6.1" ,
8686 "@types/semver" : " ~7.7.0" ,
Original file line number Diff line number Diff line change 11{
2+ "$schema" : " ./node_modules/wrangler/config-schema.json" ,
23 "main" : " .open-next/worker.js" ,
34 "name" : " nodejs-website" ,
45 "compatibility_date" : " 2024-11-07" ,
910 "assets" : {
1011 "directory" : " .open-next/assets" ,
1112 "binding" : " ASSETS" ,
13+ "run_worker_first" : true ,
14+ },
15+ "vars" : {
16+ // Variables needed for skew protection
17+ // Also not that an appropriate CF_WORKERS_SCRIPTS_API_TOKEN secret
18+ // needs to be set as well in the Cloudflare dashboard
19+ "CF_WORKER_NAME" : " nodejs-website" ,
20+ "CF_PREVIEW_DOMAIN" : " testing.devprod.cloudflare.dev" ,
21+ "CF_ACCOUNT_ID" : " 8ed4d03ac99f77561d0e8c9cbcc76cb6" ,
1222 },
1323 "observability" : {
1424 "enabled" : true ,
You can’t perform that action at this time.
0 commit comments