Skip to content

fix(docker): copy head-response-guard.cjs into the standalone bundle (boot crash) - #6841

Closed
MikeTuev wants to merge 1 commit into
diegosouzapw:release/v3.8.47from
MikeTuev:fix/docker-standalone-head-guard
Closed

MikeTuev wants to merge 1 commit into
diegosouzapw:release/v3.8.47from
MikeTuev:fix/docker-standalone-head-guard

Conversation

@MikeTuev

Copy link
Copy Markdown
Contributor

Problem

The standalone Docker image (targets runner-base / runner-web / runner-cli) crashes at boot:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/head-response-guard.cjs' imported from /app/server-ws.mjs

#6608 ("close HEAD requests immediately instead of hanging", #6400) added

import headResponseGuard from "./head-response-guard.cjs";

to scripts/dev/standalone-server-ws.mjs, but did not add a copy entry to scripts/build/assembleStandalone.mjs. That script copies each server-ws.mjs sibling dependency into the standalone bundle individually (peer-stamp.mjs, http-method-guard.cjs, responses-ws-proxy.mjs, webdav-handler.mjs, tls-options.mjs) — so the new module never lands in the image and the container restart-loops.

Fix

  • Add the missing copy entry for head-response-guard.cjs to assembleStandalone.mjs.
  • Regression test tests/unit/standalone-server-ws-deps-copied.test.ts extracts all relative imports of standalone-server-ws.mjs and asserts each one has a copy entry — so any future sibling module added to server-ws without a copy entry fails CI instead of breaking the container at boot.

Validation (TDD, Hard Rule #18)

  • Test written first, failed with: assembleStandalone.mjs must copy these server-ws.mjs dependencies: head-response-guard.cjs; passes after the fix.
  • Rebuilt the Docker image (--target runner-cli) from this branch and verified /app/head-response-guard.cjs and /app/server-ws.mjs are present; the previous ERR_MODULE_NOT_FOUND boot crash is gone.

diegosouzapw#6608 added `import headResponseGuard from './head-response-guard.cjs'` to
scripts/dev/standalone-server-ws.mjs but never added the copy entry to
assembleStandalone.mjs. The standalone Docker image crashed at boot with
ERR_MODULE_NOT_FOUND /app/head-response-guard.cjs.

The new test derives ALL relative imports of standalone-server-ws.mjs and
asserts each has a copy entry, so a future sibling module cannot silently
break the container again.
@MikeTuev
MikeTuev requested a review from diegosouzapw as a code owner July 11, 2026 01:20
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks for catching this — same root cause and same fix as #6908, which was opened independently and landed a slightly more thorough regression test (it exercises the real copy function against a temp directory rather than string-matching the source). Since both patches touch the identical EXTRA_MODULE_ENTRIES lines and conflict with each other, I'm merging #6908 and closing this one as a duplicate rather than asking you to rebase around it. Appreciate the report and the Docker-side repro — that's genuinely useful confirmation the fix also resolves the container boot crash, not just the CLI dist.

@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks for catching this — same root cause and same fix as #6908, which landed a slightly more thorough regression test (exercises the real copy function against a temp dir rather than string-matching the source). Both patches touch the identical EXTRA_MODULE_ENTRIES lines and would conflict, so I merged #6908 and am closing this as a duplicate. Appreciate the report and the Docker-side repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants