Skip to content

Commit 07919d8

Browse files
Add WORKER_SELF_REFERENCE service configuration to the wrangler.jsonc template (#1020)
* Add `WORKER_SELF_REFERENCE` service configuration to the `wrangler.jsonc` template * fixup! replace all occurences --------- Co-authored-by: Victor Berchet <victor@suumit.com>
1 parent f8dc12e commit 07919d8

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.changeset/major-bugs-wave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": minor
3+
---
4+
5+
Add missing WORKER_SELF_REFERENCE service binding in the wrangler.jsonc that the CLI creates

packages/cloudflare/src/cli/build/utils/create-config-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function createWranglerConfigIfNotExistent(projectOpts: ProjectOpti
4040

4141
const appName = getAppNameFromPackageJson(projectOpts.sourceDir) ?? "app-name";
4242
if (appName) {
43-
wranglerConfig = wranglerConfig.replace('"app-name"', JSON.stringify(appName.replaceAll("_", "-")));
43+
wranglerConfig = wranglerConfig.replaceAll('"app-name"', JSON.stringify(appName.replaceAll("_", "-")));
4444
}
4545

4646
const compatDate = await getLatestCompatDate();

packages/cloudflare/templates/wrangler.jsonc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
"directory": ".open-next/assets",
99
"binding": "ASSETS"
1010
},
11+
"services": [
12+
{
13+
"binding": "WORKER_SELF_REFERENCE",
14+
"service": "app-name"
15+
}
16+
],
1117
"r2_buckets": [
1218
// Use R2 incremental cache
1319
// See https://opennext.js.org/cloudflare/caching

0 commit comments

Comments
 (0)