Skip to content

Commit 4f926cd

Browse files
emily-shenCarmenPopoviciu
authored andcommitted
pr feedback
1 parent 85c9a26 commit 4f926cd

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

fixtures/get-platform-proxy/wrangler_external_do.jsonc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
2-
"name": "external_do",
2+
"name": "external-do",
33
"main": "src/index.ts",
4-
// external durable object - has script name
4+
// external durable object = binding has script_name. This indicates that
5+
// the DO is exported in a separate Worker called `do-worker`. For the
6+
// purposes of testing, we don't need to set that up because
7+
// getPlatformProxy would not be involved in running that Worker.
8+
59
"durable_objects": {
610
"bindings": [
711
{
812
"class_name": "MyDurableObject",
913
"name": "MY_DURABLE_OBJECT",
10-
"script_name": "internal-do",
14+
"script_name": "do-worker",
1115
},
1216
],
1317
},

fixtures/get-platform-proxy/wrangler_internal_do.jsonc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
2-
"name": "internal_do",
2+
"name": "internal-do",
33
"main": "src/index.ts",
4-
// internal durable object
4+
// Internal durable object = the binding does not specify a script name.
5+
// This implies the DO is exported alongside this worker in `index.ts`,
6+
// which it isn't actually. However we don't care about this here because
7+
// getPlatformProxy will discard all user code anyway. We are simply making
8+
// sure the warning shows up.
59
"durable_objects": {
610
"bindings": [
711
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ async function getMiniflareOptionsFromConfig(
148148
${localBindings.map((b) => `- ${JSON.stringify(b)}`).join("\n")}
149149
These will not work in local development, but they should work in production.
150150
151-
If you want to develop these locally, you can define your DO "externally" in another worker.
151+
If you want to develop these locally, you can define your DO "externally" in another Worker.
152152
To do this, create another Worker and Wrangler config file. Export your DO from there.
153153
Then, set the \`script_name\` field in your original DO binding to equal the \`name\` field from your new external DO config.
154154
155155
You will be able to develop this locally by running:
156-
npx wrangler dev -c path/to/original/wrangler.json -c path/to/external-do/wrangler.json
156+
npx wrangler dev -c path/to/original/wrangler.jsonc -c path/to/external-do/wrangler.jsonc
157157
`);
158158
}
159159
}

packages/wrangler/src/deployment-bundle/entry.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ export function partitionDurableObjectBindings(config: Config): {
167167
const localBindings: DurableObjectBindings = [];
168168
const remoteBindings: DurableObjectBindings = [];
169169
for (const binding of config.durable_objects.bindings) {
170-
if (binding.script_name === undefined) {
170+
if (
171+
binding.script_name === undefined ||
172+
binding.script_name === config.name
173+
) {
171174
localBindings.push(binding);
172175
} else {
173176
remoteBindings.push(binding);

0 commit comments

Comments
 (0)