-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[wrangler] Display build errors for auxiliary workers in multi-worker mode #13136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
petebacondarwin
merged 5 commits into
main
from
devin/1774944127-fix-multiworker-build-errors
Mar 31, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b92f5f2
[wrangler] Display build errors for auxiliary workers in multi-worker…
devin-ai-integration[bot] 42895c4
[wrangler] Use logBuildFailure for nice esbuild error formatting in D…
devin-ai-integration[bot] 500fbe0
[wrangler] Remove duplicate logger.error() calls from BundlerControll…
devin-ai-integration[bot] 1786439
[wrangler] Use expect from test context instead of importing from vitest
devin-ai-integration[bot] d760e83
[wrangler] Remove unneeded eslint-disable directive for no-restricted…
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "wrangler": patch | ||
| --- | ||
|
|
||
| Display build errors for auxiliary workers in multi-worker mode | ||
|
|
||
| Previously, when running `wrangler dev` with multiple `-c` config flags (multi-worker mode), build errors from auxiliary/secondary workers were only logged at debug level, causing Wrangler to silently hang. Build errors from all workers are now displayed at error level so you can see what went wrong and fix it. |
99 changes: 99 additions & 0 deletions
99
packages/wrangler/src/__tests__/api/startDevWorker/DevEnv.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import { describe, test } from "vitest"; | ||
| import { DevEnv } from "../../../api/startDevWorker/DevEnv"; | ||
| import { mockConsoleMethods } from "../../helpers/mock-console"; | ||
|
|
||
| describe("DevEnv", () => { | ||
| const std = mockConsoleMethods(); | ||
|
|
||
| describe("handleErrorEvent", () => { | ||
| test("should format esbuild BuildFailure errors nicely for BundlerController", ({ | ||
| expect, | ||
| }) => { | ||
| const devEnv = new DevEnv(); | ||
|
|
||
| // Create an esbuild-like BuildFailure with errors and warnings arrays | ||
| const buildFailure = Object.assign(new Error("Build failed"), { | ||
| errors: [ | ||
| { | ||
| id: "", | ||
| pluginName: "", | ||
| text: 'Could not resolve "some-missing-module"', | ||
| location: null, | ||
| notes: [], | ||
| detail: undefined, | ||
| }, | ||
| ], | ||
| warnings: [], | ||
| }); | ||
|
|
||
| devEnv.dispatch({ | ||
| type: "error", | ||
| reason: "Failed to construct initial bundle", | ||
| cause: buildFailure, | ||
| source: "BundlerController", | ||
| data: undefined, | ||
| }); | ||
|
|
||
| expect(std.err).toContain("Build failed with 1 error"); | ||
| expect(std.err).toContain('Could not resolve "some-missing-module"'); | ||
|
|
||
| void devEnv.teardown(); | ||
| }); | ||
|
|
||
| test("should format esbuild BuildFailure from cause for BundlerController", ({ | ||
| expect, | ||
| }) => { | ||
| const devEnv = new DevEnv(); | ||
|
|
||
| // Create an esbuild-like BuildFailure nested in cause | ||
| const innerFailure = Object.assign(new Error("Build failed"), { | ||
| errors: [ | ||
| { | ||
| id: "", | ||
| pluginName: "", | ||
| text: "Syntax error in worker code", | ||
| location: null, | ||
| notes: [], | ||
| detail: undefined, | ||
| }, | ||
| ], | ||
| warnings: [], | ||
| }); | ||
| const outerError = new Error("Initial build failed."); | ||
| outerError.cause = innerFailure; | ||
|
|
||
| devEnv.dispatch({ | ||
| type: "error", | ||
| reason: "Failed to construct initial bundle", | ||
| cause: outerError, | ||
| source: "BundlerController", | ||
| data: undefined, | ||
| }); | ||
|
|
||
| expect(std.err).toContain("Build failed with 1 error"); | ||
| expect(std.err).toContain("Syntax error in worker code"); | ||
|
|
||
| void devEnv.teardown(); | ||
| }); | ||
|
|
||
| test("should log non-esbuild BundlerController errors with just the message", ({ | ||
| expect, | ||
| }) => { | ||
| const devEnv = new DevEnv(); | ||
|
|
||
| const buildError = new Error("Custom build command failed"); | ||
|
|
||
| devEnv.dispatch({ | ||
| type: "error", | ||
| reason: "Custom build failed", | ||
| cause: buildError, | ||
| source: "BundlerController", | ||
| data: { config: undefined, filePath: "src/index.ts" }, | ||
| }); | ||
|
|
||
| expect(std.err).toContain("Custom build command failed"); | ||
|
|
||
| void devEnv.teardown(); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.