Skip to content

Start frps with node's spawn so the connect-next gate builds and runs again - #6926

Merged
ymichael merged 1 commit into
mainfrom
bb/connect-next-gate-plain-spawn
Nov 3, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/connect-next-gate-plain-spawn

Conversation

@ymichael

@ymichael ymichael commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

#6194 switched the connect-next gate's frps launch (apps/connect-next/src/frps.ts) from node:child_process to spawnHostProcess from @bb/process-utils. That broke the gate in two ways:

  • The gate's Dockerfile copies only the sources of tunnel-contract, connect-db and text-utils, so the image no longer builds: Could not resolve "@bb/process-utils". The next run of Deploy Connect Next would fail at the build step. The last deploy (Oct 26, 3fcb678bf9) predates One host toolchain for executable discovery, child PATH, and proxy/CA defaults #6194, so production is unaffected.
  • @bb/process-utils brings in cross-spawn, which calls require("path"). The gate's ESM bundle can't do that, so pnpm --filter @bb/connect-next build produces a gate that crashes at startup with Dynamic require of "path" is not supported. This also breaks apps/connect-next/scripts/e2e-local.sh.

CI missed both because the gate's process test ran the TypeScript source through tsx, which resolves workspace packages and supports require.

What changed

  • frps.ts starts frps with node:child_process spawn again, and @bb/process-utils is dropped from the gate's dependencies. The gate runs in a Linux container with a fixed FRPS path, so it needs none of the host toolchain's PATH, Windows or proxy handling. Lint allows async spawn in apps.
  • test/dockerfile-build.ts builds the gate the way the Dockerfile's build stage does. It reads the stage's COPY lines, npm install packages and esbuild flags from the Dockerfile, copies only those sources into an empty temp dir, and builds with no NODE_PATH. It throws on any esbuild flag it doesn't recognise, so it can't silently drift from the Dockerfile.
  • test/main.e2e.test.ts (the gate process test: real frps, a tunnel, SIGTERM shutdown) now runs that bundle instead of the source. Deploy Connect Next runs this test before deploying.

How you verified

  • Before the fix, the updated process test fails with the Docker error, Could not resolve "@bb/process-utils". After it, it passes.
  • docker build -f apps/connect-next/Dockerfile . fails on main and succeeds on this branch. docker run of the image gets past module load to the gate's own config check (ACCOUNT_API_URL is not set).
  • The local pnpm --filter @bb/connect-next build gate now starts the same way.
  • pnpm exec turbo run typecheck lint test --filter=@bb/connect-next: 94/94 tests pass. One run hit a timing failure in regions.e2e.test.ts under high machine load (load average 65); it passed 6/6 reruns, and it starts frps through the same plain spawn it used before One host toolchain for executable discovery, child PATH, and proxy/CA defaults #6194.
  • pnpm install --frozen-lockfile passes; the lockfile change is only the removed @bb/process-utils link.

AGENT GENERATED

… again

#6194 switched the gate's frps launch to @bb/process-utils. The gate's
Dockerfile does not copy that package, so the image no longer builds, and
the package's cross-spawn uses require(), which the gate's ESM bundle
cannot load, so a local build crashed at startup. The gate runs in a
Linux container with a fixed FRPS path and needs none of the host
toolchain, so it uses node's spawn again.

The gate process test now runs a bundle built the way the Dockerfile
builds it (same copied sources, npm packages and esbuild flags) instead
of the TypeScript source, so these breakages fail CI and the deploy
workflow's tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 1e60391 into main Nov 3, 2026
51 checks passed
@ymichael
ymichael deleted the bb/connect-next-gate-plain-spawn branch November 3, 2026 20:03
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.

1 participant