multi sandbox backen support#223
Merged
Merged
Conversation
f388c79 to
3e6cecd
Compare
vigneshrajsb
added a commit
that referenced
this pull request
Jul 10, 2026
With MCP_SERVER_ENABLED=true, lifecycle-web pods crashed at boot with "Cannot find module './src/server/mcp/handler'": ws-server.ts loaded the handler via a deferred require() that sits outside tsc's static import graph, so `tsc -p tsconfig.server.json` never emitted the module. The deferred require existed only to keep the ESM-only jose / MCP SDK off the boot path on Node < 20.19 (require(esm) support). That was valid when the MCP alphas shipped on node:20-slim, but #223 moved every build to node:22-slim before this code reached main — and the Docker image welds the Node runtime to the app code, so "MCP code on Node 20" can't occur. The workaround now guards an impossible state. Import the handler statically instead. tsc traces it through ws-server.ts's import graph and emits it normally, eliminating the build-vs-runtime gap at the root (no tsconfig "include" entry needed). The MCP_SERVER_ENABLED flag still gates whether the handler is wired up; only the module load moves to boot, which is a plain require on Node 22. Verified: tsc emits .next/src/server/mcp/handler.js via the static graph (absent before); server typecheck + lint clean.
vigneshrajsb
added a commit
that referenced
this pull request
Jul 10, 2026
) With MCP_SERVER_ENABLED=true, lifecycle-web pods crashed at boot with "Cannot find module './src/server/mcp/handler'": ws-server.ts loaded the handler via a deferred require() that sits outside tsc's static import graph, so `tsc -p tsconfig.server.json` never emitted the module. The deferred require existed only to keep the ESM-only jose / MCP SDK off the boot path on Node < 20.19 (require(esm) support). That was valid when the MCP alphas shipped on node:20-slim, but #223 moved every build to node:22-slim before this code reached main — and the Docker image welds the Node runtime to the app code, so "MCP code on Node 20" can't occur. The workaround now guards an impossible state. Import the handler statically instead. tsc traces it through ws-server.ts's import graph and emits it normally, eliminating the build-vs-runtime gap at the root (no tsconfig "include" entry needed). The MCP_SERVER_ENABLED flag still gates whether the handler is wired up; only the module load moves to boot, which is a plain require on Node 22. Verified: tsc emits .next/src/server/mcp/handler.js via the static graph (absent before); server typecheck + lint clean.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.