Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/silent-queues-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Allow `wrangler dev --remote` to start when queue producer bindings are configured

Queue bindings are still unsupported in legacy remote dev mode, but Wrangler now omits them from remote preview uploads after warning. This lets unrelated routes keep working instead of returning 500 errors for the whole dev session.
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,44 @@ describe("ConfigController", () => {

expect(warningCount).toBe(1);
});

it("should warn when queues are configured in remote dev mode", async ({
expect,
}) => {
await seed({
"src/index.ts": dedent /* javascript */ `
export default {
fetch() {
return new Response("hello world")
}
}
`,
"wrangler.toml": dedent /* toml */ `
name = "my-worker"
main = "src/index.ts"
compatibility_date = "2024-06-01"

[[queues.producers]]
binding = "QUEUE"
queue = "test-queue"
`,
});

const event = bus.waitFor("configUpdate");
await controller.set({
config: "./wrangler.toml",
dev: {
remote: true,
auth: {
accountId: "some-account-id",
apiToken: { apiToken: "some-api-token" },
},
},
});
await event;

expect(std.warn).toContain(
"Queues are not yet supported in wrangler dev remote mode."
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,42 @@ describe("RemoteRuntimeController", () => {
vi.mocked(getAccessHeaders).mockResolvedValue({});
});

describe("unsupported queue bindings", () => {
it("should omit queue producer bindings from remote preview uploads", async ({
expect,
}) => {
const { controller, bus } = setup();
const config = makeConfig({
bindings: {
QUEUE: {
type: "queue",
queue_name: "test-queue",
},
KV: {
type: "kv_namespace",
id: "test-kv-namespace",
},
},
});
const bundle = makeBundle();

controller.onBundleStart({ type: "bundleStart", config });
controller.onBundleComplete({ type: "bundleComplete", config, bundle });
await bus.waitFor("reloadComplete");

expect(createRemoteWorkerInit).toHaveBeenCalledWith(
expect.objectContaining({
bindings: {
KV: {
type: "kv_namespace",
id: "test-kv-namespace",
},
},
})
);
});
});

describe("stale bundle bail-out", () => {
it("should skip stale bundles and only reload once for rapid updates", async ({
expect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ import type {
ReloadCompleteEvent,
ReloadStartEvent,
} from "./events";
import type { Bundle, StartDevWorkerOptions, Trigger } from "./types";
import type { Binding, Bundle, StartDevWorkerOptions, Trigger } from "./types";
import type { Route } from "@cloudflare/workers-utils";

type CreateRemoteWorkerInitProps = Parameters<typeof createRemoteWorkerInit>[0];

function getRemotePreviewBindings(
bindings: StartDevWorkerOptions["bindings"]
): Record<string, Binding> {
return Object.fromEntries(
Object.entries(bindings ?? {}).filter(
([, binding]) => binding.type !== "queue"
)
);
}
Comment on lines +43 to +51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 No warning emitted at the filtering site — relies on ConfigController warning upstream

The getRemotePreviewBindings function at packages/wrangler/src/api/startDevWorker/RemoteRuntimeController.ts:43-51 silently drops queue bindings without logging any warning. The changeset description states bindings are omitted "after warning," but that warning comes from a separate code path in packages/wrangler/src/api/startDevWorker/ConfigController.ts:504 ("Queues are not yet supported in wrangler dev remote mode."). If that ConfigController code path is ever bypassed or removed, queue bindings would be silently dropped with no user notification. The test also doesn't assert that any warning is logged. Worth verifying the ConfigController warning is reliably triggered in the same flow.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 51532c5 by adding ConfigController coverage that verifies the existing Queues are not yet supported in wrangler dev remote mode. warning is emitted for a remote-dev queue producer config, alongside the RemoteRuntimeController test that verifies queue bindings are omitted from the preview upload.


export class RemoteRuntimeController extends RuntimeController {
#abortController = new AbortController();

Expand Down Expand Up @@ -156,7 +166,7 @@ export class RemoteRuntimeController extends RuntimeController {
assets: props.assets,
legacyAssetPaths: props.legacyAssetPaths,
format: props.format,
bindings: props.bindings,
bindings: getRemotePreviewBindings(props.bindings),
compatibilityDate: props.compatibilityDate,
compatibilityFlags: props.compatibilityFlags,
});
Expand Down