Skip to content

Commit 01078de

Browse files
committed
move to a docs link
1 parent 74d95fd commit 01078de

File tree

2 files changed

+7
-73
lines changed

2 files changed

+7
-73
lines changed

fixtures/get-platform-proxy/tests/get-platform-proxy.env.test.ts

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -226,42 +226,9 @@ describe("getPlatformProxy - env", () => {
226226
227227
- {"class_name":"MyDurableObject","name":"MY_DURABLE_OBJECT"}
228228
These will not work in local development, but they should work in production.
229-
229+
230230
If you want to develop these locally, you can define your DO "externally" in another Worker.
231-
To do this, create another Worker, e.g.
232-
233-
export class MyDurableObject extends DurableObject {
234-
// DO code goes here
235-
}
236-
export default {
237-
fetch() {
238-
// doesn't have to do anything, but DO cannot be the default export
239-
}
240-
}
241-
242-
Also create a new Wrangler config file for this Worker, e.g.
243-
244-
{
245-
"name": "external-do-worker",
246-
"main": "src/index.ts",
247-
"compatibility_date": "XXXX-XX-XX"
248-
}
249-
250-
Then, update your original DO bindings to include the script_name field, e.g.
251-
{
252-
"durable_objects": {
253-
"bindings": [
254-
{
255-
"name": "BINDING",
256-
"class_name": "MyDurableObject",
257-
"script_name": "external-do-worker"
258-
}
259-
]
260-
}
261-
}
262-
263-
You will be able to develop this locally by running:
264-
npx wrangler dev -c path/to/original/wrangler.jsonc -c path/to/external-do/wrangler.jsonc
231+
Refer to https://developers.cloudflare.com/durable-objects/platform/known-issues/#local-development-with-web-frameworks for guidance on how to do this.
265232
266233
",
267234
],
@@ -275,6 +242,7 @@ describe("getPlatformProxy - env", () => {
275242
}
276243
`);
277244
});
245+
278246
it("doesn't warn about external DOs and doesn't crash", async () => {
279247
await getPlatformProxy<Env>({
280248
configPath: path.join(__dirname, "..", "wrangler_external_do.jsonc"),

packages/wrangler/src/api/integrations/platform/index.ts

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { kCurrentWorker, Miniflare } from "miniflare";
22
import { getAssetsOptions } from "../../../assets";
3-
import { formatConfigSnippet, readConfig } from "../../../config";
3+
import { readConfig } from "../../../config";
44
import { partitionDurableObjectBindings } from "../../../deployment-bundle/entry";
55
import { DEFAULT_MODULE_RULES } from "../../../deployment-bundle/rules";
66
import { getBindings } from "../../../dev";
@@ -109,8 +109,7 @@ export async function getPlatformProxy<
109109
MULTIWORKER: false,
110110
RESOURCES_PROVISION: false,
111111
},
112-
() =>
113-
getMiniflareOptionsFromConfig(rawConfig, env, options, options.configPath)
112+
() => getMiniflareOptionsFromConfig(rawConfig, env, options)
114113
);
115114

116115
const mf = new Miniflare({
@@ -137,8 +136,7 @@ export async function getPlatformProxy<
137136
async function getMiniflareOptionsFromConfig(
138137
rawConfig: Config,
139138
env: string | undefined,
140-
options: GetPlatformProxyOptions,
141-
configPath: string | undefined
139+
options: GetPlatformProxyOptions
142140
): Promise<Partial<MiniflareOptions>> {
143141
const bindings = getBindings(rawConfig, env, true, {});
144142

@@ -151,39 +149,7 @@ async function getMiniflareOptionsFromConfig(
151149
These will not work in local development, but they should work in production.
152150
153151
If you want to develop these locally, you can define your DO "externally" in another Worker.
154-
To do this, create another Worker, e.g.
155-
156-
export class MyDurableObject extends DurableObject {
157-
// DO code goes here
158-
}
159-
export default {
160-
fetch() {
161-
// doesn't have to do anything, but DO cannot be the default export
162-
}
163-
}
164-
165-
Also create a new Wrangler config file for this Worker, e.g.
166-
167-
${formatConfigSnippet({ name: "external-do-worker", main: "src/index.ts", compatibility_date: "XXXX-XX-XX" }, configPath)}
168-
169-
Then, update your original DO bindings to include the script_name field, e.g.
170-
${formatConfigSnippet(
171-
{
172-
durable_objects: {
173-
bindings: [
174-
{
175-
name: "BINDING",
176-
class_name: "MyDurableObject",
177-
script_name: "external-do-worker",
178-
},
179-
],
180-
},
181-
},
182-
configPath
183-
)}
184-
185-
You will be able to develop this locally by running:
186-
npx wrangler dev -c path/to/original/wrangler.jsonc -c path/to/external-do/wrangler.jsonc
152+
Refer to https://developers.cloudflare.com/durable-objects/platform/known-issues/#local-development-with-web-frameworks for guidance on how to do this.
187153
`);
188154
}
189155
}

0 commit comments

Comments
 (0)