Skip to content

Bug: latest main cannot boot on docker:dev — convex deploy fails ModulesTooLarge (42.97 MiB > 42.92 MiB cap), platform crash-loops #2579

Closed

Description

@larryro

What happened

On current main (84384c2), the docker:dev platform container can no longer finish its boot-time convex deploy: the self-hosted Convex backend rejects the push with

Error fetching POST http://convex:3210/api/deploy2/evaluate_push 400 Bad Request: ModulesTooLarge:
Total module size exceeded the zipped maximum (42.97 MiB > maximum size 42.92 MiB)

The entrypoint exits, Docker restarts it, and the container crash-loops indefinitely (observed RestartCount=189 over ~2h; each cycle re-waits 10s, re-syncs env, re-fails). The whole app is down — the proxy has no healthy platform upstream.

The margin story (why it worked this morning and not now)

Steps to reproduce

  1. Check out current main; bun run docker:dev (compose.dev.yml bind-mounts ./services/platform/convex into the container, so the host checkout is what deploys).
  2. Watch docker logs tale-platform — boot reaches "Running convex deploy" and fails with the error above; docker inspect tale-platform shows the restart count climbing.
  3. curl -skf https://localhost/api/health never succeeds (no healthy platform behind the proxy).

Expected behavior

main boots on the documented docker:dev path. A bundle-size regression this close to a hard backend cap should be caught before merge, not at operator boot time.

Evidence / diagnostics gathered

  • Bundle dump via bunx convex deploy --debug-bundle-path inside the shipping image: 108 MB raw dump (node/ modules ≈ 45 MB raw + maps; fullConfig.json 46 MB); no single giant module — the overflow is cumulative across node/_deps/* chunks (largest ~2 MB).
  • All 11 convex.json → node.externalPackages resolve in the container except canvas, which is a dangling symlink in /app/node_modules (payload missing). Worth checking as a contributor/separate packaging nit — scripts/link-convex-externals.ts documents exactly this class of failure ("without this the heavy node-only libs get bundled inline and the push fails … module-size").
  • Minor: the entrypoint's error diagnosis says "compiled modules exceed the 45 MB gzip limit" while the backend enforces 42.92 MiB — the hint understates how close the budget is.

Proposed change

  • Short term: prune/split the node bundle back under the cap (dedupe deps across convex/ actions, verify canvas externalization actually works in the Docker image, move/lazy-load the new external-agent runner code).
  • Guard: add a CI check that measures the zipped convex module size (e.g. via --debug-bundle-path + gzip) and fails above a threshold (~40 MiB) so main can't silently exhaust the margin again.
  • Resilience: consider a bounded restart/backoff or a clearer "deploy too large" surface instead of an infinite crash-loop.

Acceptance criteria

  • bun run docker:dev on main boots to a healthy platform again.
  • CI fails when the zipped convex module bundle exceeds a defined budget below the backend cap.
  • node_modules/canvas is a real, resolvable package in the platform image (no dangling symlink).

Activity

  1. added
    priority: high
    bug
    service: platform
    on Jul 8, 2026
  2. larryro commented on Jul 8, 2026

    @larryro
    ContributorAuthor

    Root-caused and fixed on PR #2548 (rides that branch since it was blocking its CI; the PR body carries a Fixes #2579).

    The mechanism is worse than bundle creep: the 42.92 MiB cap sums the app modules plus the external-deps package the backend builds server-side from npm (build_external_node_deps — the CLI only uploads a name@version list). A fresh backend (docker:dev boot, CI, any new deployment) re-resolves the externals' transitive closure from npm at push time, so the total drifts with upstream releases even on an unchanged checkout — while a backend that already cached its external-deps package keeps accepting the same push. That asymmetry is why 75d47b3 deployed at 11:30Z and the same stack crash-looped later, and why local dev never reproduced it.

    Fix (1efc1ff97): drop the pure-JS packages — zod, ai, yaml, @modelcontextprotocol/sdk — from convex.json externalPackages so they bundle tree-shaken instead of shipping whole npm trees. Fresh-backend push measured before/after: 42.97 → 35.38 MiB (7.5 MiB headroom); external-deps package 30 → 20.2 MiB. The remaining external elephants are mssql→tedious→@azure/* (~12 MiB zipped, feature weight) and jsdom (~5 MiB, only three crawler helpers — linkedom candidate, tracked separately).

    • The dangling canvas symlink you found is vestigial config: nothing bundled imports canvas and the CLI never listed it in nodeDependencies — removed from externalPackages in ea42f6c51, which retires that entire failure mode.
    • Acceptance criterion 2 (a CI budget below the hard cap) stays open: the app-side bundle zips measurably, but the external-deps package only materializes server-side, so a meaningful guard needs to read the backend's Source/External deps package size log lines after a fresh push (the E2E preflight already does the fresh push — it just fails at the cap instead of a budget). Same for the crash-loop backoff.

    After the PR: bun run docker:dev boots again (criterion 1), canvas resolves by removal (criterion 3).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: highservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions