Skip to content

Commit cc47c4e

Browse files
committed
elaborate on error message
1 parent 700ef92 commit cc47c4e

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,24 @@ describe("getPlatformProxy - env", () => {
227227
- {"class_name":"MyDurableObject","name":"MY_DURABLE_OBJECT"}
228228
These will not work in local development, but they should work in production.
229229
230-
If you want to develop these locally, you can define your DO "externally" in another worker.
231-
To do this, create another Worker and Wrangler config file. Export your DO from there.
230+
If you want to develop these locally, you can define your DO "externally" in another Worker.
231+
To do this, create another Worker:
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.
243+
232244
Then, set the \`script_name\` field in your original DO binding to equal the \`name\` field from your new external DO config.
233245
234246
You will be able to develop this locally by running:
235-
npx wrangler dev -c path/to/original/wrangler.json -c path/to/external-do/wrangler.json
247+
npx wrangler dev -c path/to/original/wrangler.jsonc -c path/to/external-do/wrangler.jsonc
236248
237249
",
238250
],

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,19 @@ async function getMiniflareOptionsFromConfig(
149149
These will not work in local development, but they should work in production.
150150
151151
If you want to develop these locally, you can define your DO "externally" in another Worker.
152-
To do this, create another Worker and Wrangler config file. Export your DO from there.
152+
To do this, create another Worker:
153+
154+
export class MyDurableObject extends DurableObject {
155+
// DO code goes here
156+
}
157+
export default {
158+
fetch() {
159+
// doesn't have to do anything, but DO cannot be the default export
160+
}
161+
}
162+
163+
Also create a new Wrangler config file for this Worker.
164+
153165
Then, set the \`script_name\` field in your original DO binding to equal the \`name\` field from your new external DO config.
154166
155167
You will be able to develop this locally by running:

0 commit comments

Comments
 (0)