File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed
fixtures/get-platform-proxy
api/integrations/platform Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change 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 },
Original file line number Diff line number Diff line change 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 {
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments