Skip to content
Merged
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/tricky-starfishes-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": minor
---

We're soon going to make backend changes that mean that `wrangler dev --remote` sessions will no longer have an associated inspector connection. In advance of these backend changes, we've enabled a new `wrangler tail`-based logging strategy for `wrangler dev --remote`. For now, you can revert to the previous logging strategy with `wrangler dev --remote --no-x-tail-logs`, but in future it will not be possible to revert.

The impact of this will be that logs that were previously available via devtools will now be provided directly to the Wrangler console and it will no longer be possible to interact with the remote Worker via the devtools console.
2 changes: 1 addition & 1 deletion packages/wrangler/src/api/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export async function unstable_dev(
enableContainers: options?.experimental?.enableContainers ?? false,
dockerPath,
containerEngine: options?.experimental?.containerEngine,
experimentalTailLogs: false,
experimentalTailLogs: true,
};

//outside of test mode, rebuilds work fine, but only one instance of wrangler will work at a time
Expand Down
15 changes: 10 additions & 5 deletions packages/wrangler/src/api/startDevWorker/ProxyController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,16 @@ export class ProxyController extends Controller {
// inspector endpoint.
const inVscodeJsDebugTerminal = !!process.env.VSCODE_INSPECTOR_OPTIONS;

return (
this.latestConfig?.dev.inspector !== false &&
!inVscodeJsDebugTerminal &&
!this.latestConfig?.experimental?.tailLogs
);
const shouldEnableInspector =
this.latestConfig?.dev.inspector !== false && !inVscodeJsDebugTerminal;

if (this.latestConfig?.dev.remote) {
// In `wrangler dev --remote`, only enable the inspector if the `--x-tail-logs` flag is disabled
return (
shouldEnableInspector && !this.latestConfig?.experimental?.tailLogs
);
}
return shouldEnableInspector;
}

// ******************
Expand Down
3 changes: 2 additions & 1 deletion packages/wrangler/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ export const dev = createCommand({
alias: ["x-tail-logs"],
describe:
"Experimental: Get runtime logs for the remote worker via Workers Tails rather than the Devtools inspector",
default: false,
default: true,
hidden: true,
},
},
async validateArgs(args) {
Expand Down
9 changes: 7 additions & 2 deletions packages/wrangler/src/dev/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import type { DevEnv } from "../api";

export default function registerDevHotKeys(
devEnvs: DevEnv[],
args: { forceLocal?: boolean; experimentalTailLogs: boolean },
args: {
forceLocal?: boolean;
experimentalTailLogs: boolean;
remote: boolean;
},
render = true
) {
const primaryDevEnv = devEnvs[0];
Expand All @@ -28,7 +32,8 @@ export default function registerDevHotKeys(
label: "open devtools",
// Don't display this hotkey if we're in a VSCode debug session
disabled:
!!process.env.VSCODE_INSPECTOR_OPTIONS || args.experimentalTailLogs,
!!process.env.VSCODE_INSPECTOR_OPTIONS ||
(args.remote && args.experimentalTailLogs),
handler: async () => {
const { inspectorUrl } = await primaryDevEnv.proxy.ready.promise;

Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/pages/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ export const pagesDevCommand = createCommand({
siteInclude: undefined,
siteExclude: undefined,
enableContainers: false,
experimentalTailLogs: false,
experimentalTailLogs: true,
})
);

Expand Down
Loading