Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(build): stop building web source maps the image build deletes (#15789)

Hazem Adel9e493a87f471
diff --git a/Dockerfile b/Dockerfile
index b372372fa0d..3a2934e2ef8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -95,11 +95,12 @@ COPY . .
# Build frontend, engine, server API, and worker
RUN NODE_OPTIONS=--max-old-space-size=4096 npx turbo run build --filter=web --filter=@activepieces/engine --filter=api --filter=worker
-# The web build emits hidden source maps (vite build.sourcemap='hidden') used to
-# symbolicate production stack traces in Sentry/BetterStack error tracking. Upload
-# them here (cloud CI, guarded by a token) BEFORE stripping, then always remove the
-# .map files so source is never served from the shipped image (self-hosted too).
-# TODO(cloud-ci): inject + upload maps with sentry-cli when SENTRY_AUTH_TOKEN is set.
+# Source maps are off unless AP_BUILD_SOURCEMAP=true: generating them costs ~1GB of
+# peak heap in the web build (3.5GB vs 2.5GB measured) for ~21MB of output that this
+# layer then deletes, which is what OOM-killed the image build. A build that opts in
+# must upload them BEFORE this line; the delete stays so source is never served from
+# the shipped image.
+# TODO(cloud-ci): set AP_BUILD_SOURCEMAP=true and upload with sentry-cli when SENTRY_AUTH_TOKEN is set.
RUN find dist/packages/web -name '*.map' -delete
# Generate migration manifest (ordered list of migration names) for image-tag-based rollback
diff --git a/brain/knowledge/engineering/ci-pr-review-hygiene.md b/brain/knowledge/engineering/ci-pr-review-hygiene.md
index 65f3e930e25..121f51ef361 100644
--- a/brain/knowledge/engineering/ci-pr-review-hygiene.md
+++ b/brain/knowledge/engineering/ci-pr-review-hygiene.md
@@ -84,3 +84,7 @@ Enforcement is the **`Codeowners review` repository ruleset** (active on the def
- **Mintlify-editor PRs arrive with `untitled-page*.mdx` at the docs root and `(1)`/`(2)`-suffixed media, wired into `docs.json` under those names.** The bot commits whatever the web editor autosaved, so pages land as `docs/untitled-page-5.mdx` rather than in the folder their nav group implies, and re-uploaded assets keep the browser's download-collision suffix (`data-flow-(1).mp4`, `01---insert-panel-(1.2x).mp4`). Mintlify's own link check passes — the names are internally consistent — so nothing flags it. Rename the files, fix the `docs.json` entries, then diff the *flattened nav tree* against `main` rather than reading the raw JSON diff: the editor also reindents, which buried a real change (the Enterprise Control `Security` group demoted to a child of `Guides`) inside 242 lines of whitespace churn on that PR.
- **After rewriting a lower branch of a stack, the `--onto` upstream you need is that branch's *old* tip, and `<branch>@{1}` is where to read it.** Every commit above a rewritten branch has to be replayed with `git rebase --onto <new lower tip> <old lower tip> <upper>`, and the old tip stops being reachable by name the moment the rebase finishes. Guessing a SHA from an earlier terminal scroll either fails outright with `invalid upstream` or, worse, succeeds against the wrong base and replays a handful of commits instead of all of them, which surfaces as a pile of conflicts the branch has with itself. `git rev-parse <branch>@{1}` reads it from the reflog every time. Re-run the whole `--onto` chain top-down after any lower-branch amend, and confirm afterwards that `git log --format=%s main..<top>` has no duplicate subjects.
- **Never commit a shared file onto a lower branch of a stack by copying it in from the stack top — you drag the upper branches' edits down with it.** Adding one gotcha bullet to a brain page while sitting on the top branch, then `git checkout <stash-or-top> -- <file>` after switching to the base branch, brings the *whole* file across, so every bullet the upper branches added to that page is silently duplicated onto the base. The commit stat is the tell: a one-line edit that reports six insertions is not a one-line edit. Switch branches first, re-apply the edit against **that branch's own copy** of the file, and re-check the stat before committing.
+- **Cherry-picking a merged PR onto a release branch: the commit-msg hook rejects it, and `breaking-changes.mdx` conflicts pull in other people's entries.** GitHub writes the squash header server-side, so `fix(flows): … instead of reverting them (#14899)` never faced commitlint — replaying it locally trips the 100-character header limit and `git cherry-pick --continue` dies in husky with the working tree half-applied. Finish it with `git commit --no-verify -C <original-sha>` rather than rewording, so the release branch keeps the same subject as `main`. The `Unreleased` section of `docs/install/reference/breaking-changes.mdx` conflicts on almost every pick because it accumulates entries from unrelated `main` work: take only the section your own commit added. **Take it by its own heading, not by "everything after the marker" — the incoming side of that hunk usually runs on into `main`'s copy of an already-published `## X.Y.Z` section, and pasting the tail duplicates ~200 lines of published notes that no test, lint or typecheck will ever notice.** The reliable move is to rebuild the file: `git checkout origin/release/<version> -- docs/install/reference/breaking-changes.mdx`, then insert your entry under its own `## <new version>` heading above the previous release's, and confirm with `git diff --stat` that only your lines are added and `grep -c '^## '` that no version heading appears twice. Then run `bun install` before pushing — the release branch's `bun.lock` is usually stale against its own `package.json`s, and the pick drags those stale piece versions along until install corrects them; `git diff --stat origin/release/<version> -- bun.lock` should come back as just the packages your pick actually bumped. Expect the **PR size** gate to block it too: the picked commits drag their own upstream tests along (769/600 in `server/api` for two picks), and splitting a replay of already-reviewed work is the wrong answer — add `large-pr-ok`.
+- **`api#test-ce` can exit 1 with every test passing — read the `Errors` line, not just `Tests`.** Vitest fails the run on *unhandled* errors too, so the summary reads `Test Files 92 passed`, `Tests 1076 passed`, `Errors 3 errors` and turbo reports `Failed: api#test-ce`. The recurring one is `TypeError: socket.destroySoon is not a function` at `Timeout.forceClose` in `@hono/node-server`, attributed to `test/integration/ce/mcp/mcp-platform-project-selection.test.ts` — a teardown race after the test already finished, not a failure of whatever you changed. Before chasing it, scroll to the `Unhandled Errors` block and check whether any test actually failed; if none did and the stack is in `forceClose`, re-run the job (`gh run rerun <id> --failed`) rather than editing code. Note the log section only has the whole `main` job, so `gh run view --job <id> --log-failed` buries it under thousands of lines of passing-test stderr — grep for `Unhandled Errors` or `Test Files`.
+- **MinIO pulled its images from Docker Hub and then quay.io; the smoke test's S3 leg uses Chainguard's now.** Both moves failed the same way, `pull access denied` on Docker Hub and then `unauthorized: access to the requested resource is not authorized` on `quay.io/minio/*`. That reads like a rate limit or a missing secret, but it's neither, so no `docker login` or retry helps. `benchmark/docker-compose.minio.yml` pins `cgr.dev/chainguard/minio` and `cgr.dev/chainguard/minio-client` by digest. They are distroless, with no shell and no `mc` in the server image, so readiness is a one-shot `mc ready local` job and the bucket is a plain `mc mb`, both through `MC_HOST_local`. Don't add a healthcheck or an `sh -c` entrypoint there. This blocks **every** self-hosted release, because the S3 leg runs inside the release's own preflight. Check a vanished image with `docker manifest inspect <image>` before assuming credentials.
+- **The web build spent ~1GB of peak heap on source maps the next Docker layer deleted.** `vite.config.mts` had `sourcemap: 'hidden'` for a Sentry upload that was never implemented — the Dockerfile ran `find dist/packages/web -name '*.map' -delete` right after, under its own unfinished `TODO(cloud-ci)`. Measured: **3.54GB peak RSS / 18.1s with maps, 2.53GB / 12.0s without** (382 map files, 21.5MB, for a 5MB main chunk). On a 2-vCPU/8GB depot runner, where turbo runs `web`, `api`, `worker` and `engine` builds concurrently in one container, that GB was the margin — `web:build` died with `Ineffective mark-compacts near heap limit` and took the release's preflight with it. It is **marginal, not deterministic**: the same commit builds fine on a retry, so a green build does not mean the headroom is there. Now behind `AP_BUILD_SOURCEMAP=true` (default off). Whoever implements the Sentry upload must set that flag *and* upload before the delete line.
diff --git a/packages/web/vite.config.mts b/packages/web/vite.config.mts
index 8e66be6a83d..a6a9d615cf8 100644
--- a/packages/web/vite.config.mts
+++ b/packages/web/vite.config.mts
@@ -10,6 +10,7 @@ import customHtmlPlugin from './vite-plugins/html-plugin';
export default defineConfig(({ command, mode }) => {
const isDev = command === 'serve' || mode === 'development';
+ const emitSourcemap = process.env.AP_BUILD_SOURCEMAP === 'true';
const AP_TITLE = 'Activepieces';
const AP_FAVICON = 'https://activepieces.com/favicon.ico';
@@ -164,7 +165,7 @@ export default defineConfig(({ command, mode }) => {
outDir: '../../dist/packages/web',
emptyOutDir: true,
reportCompressedSize: true,
- sourcemap: 'hidden',
+ sourcemap: emitSourcemap ? 'hidden' : false,
commonjsOptions: {
transformMixedEsModules: true,
},