Skip to content

Commit a3ed9a7

Browse files
Fix bindings with remote: true being logged as remote when run via wrangler dev --local
1 parent 90a2566 commit a3ed9a7

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.changeset/thirty-lights-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Fix bindings with `remote: true` being logged as `remote` when run via `wrangler dev --local`

packages/wrangler/src/__tests__/dev/remote-bindings.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,18 @@ describe("dev with remote bindings", { sequential: true }, () => {
653653
await vi.waitFor(() => expect(std.out).toMatch(/Ready/), {
654654
timeout: 2_000,
655655
});
656+
const bindingsPrintStart = std.out.indexOf(
657+
"Your Worker has access to the following bindings:"
658+
);
659+
const bindingsPrintEnd = std.out.indexOf("⎔ Starting local server...") - 1;
660+
expect(std.out.slice(bindingsPrintStart, bindingsPrintEnd))
661+
.toMatchInlineSnapshot(`
662+
"Your Worker has access to the following bindings:
663+
Binding Resource Mode
664+
env.KV_LOCAL_BINDING (mock-kv-namespace) KV Namespace local
665+
env.KV_REMOTE_BINDING (mock-kv-namespace) KV Namespace local
666+
"
667+
`);
656668
expect(proxyWorkerBindings).toEqual(undefined);
657669
expect(workerOptions).toEqual([
658670
expect.objectContaining({

packages/wrangler/src/utils/print-bindings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ function createGetMode({
759759
return dim("not supported");
760760
}
761761

762-
return `${isSimulatedLocally ? chalk.blue("local") : chalk.yellow("remote")}${connected === undefined ? "" : connected ? chalk.green(" [connected]") : chalk.red(" [not connected]")}`;
762+
return `${isSimulatedLocally || isLocalDev ? chalk.blue("local") : chalk.yellow("remote")}${connected === undefined ? "" : connected ? chalk.green(" [connected]") : chalk.red(" [not connected]")}`;
763763
};
764764
}
765765

0 commit comments

Comments
 (0)