Skip to content

fix(deploy): declare @sap-ai-sdk externals in srv-qa + srv-mcp (boot crash) - #2531

Merged
jung-thomas merged 1 commit into
DEVfrom
worktree-mcp-auth-multipackage
Sep 28, 2026
Merged

jung-thomas merged 1 commit into
DEVfrom
worktree-mcp-auth-multipackage

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

Problem

After srv-qa staging was fixed (#2530), srv-qa CRASHED at CF boot:

ERR_MODULE_NOT_FOUND: Cannot find package '@sap-ai-sdk/orchestration'
  imported from srv/lib/_shared/content.bundle.mjs

Root cause (general class)

bundle-shared.cjs marks @sap-ai-sdk/* + @sap/* as external (correct — large CF-runtime SDKs, not inlined). Externals must exist in the consuming module's node_modules at CF. The content bundle transitively imports @sap-ai-sdk/orchestration + @sap-ai-sdk/foundation-models (via packages/content/category-classifier-llm.js), so every module shipping that bundle must declare them.

  • srv-qa had foundation-models but was missing orchestration → boot crash.
  • srv-mcp had neither, but its core bundle imports foundation-models → would crash the same way on the mcp-MTA deploy.
  • main srv declares both (root package.json) → booted fine.

Fix

  • srv-qa/package.json: + @sap-ai-sdk/orchestration@^2.12.0
  • srv-mcp/package.json: + @sap-ai-sdk/foundation-models@^2.12.0
    (@sap-ai-sdk is published — installs at CF staging; unlike @tutorials/* which is stripped.)

New gate

scripts/check-bundle-externals-declared.cjs + 18 tests: for each module shipping a *.bundle.mjs, parses the bundle's bare external imports and asserts each is in that module's package.json deps. Includes a regression test modelling the exact pre-fix srv-qa state. Wired into static-guards. This is the class behind the last several DEV crashes (workspace/externals must be present-or-bundled per module).

Verified

  • check-bundle-externals-declared passes live; 29/29 new tests pass.
  • External-vs-deps proof (srv-qa + srv-mcp): every @sap-ai-sdk/*+@sap/* a bundle imports is now declared.

4th deploy blocker for the carve → DEV. Backend healthy; srv-qa staged (#2530); this fixes srv-qa (and pre-empts srv-mcp) boot.

srv-qa/package.json was missing @sap-ai-sdk/orchestration, causing a boot
crash on DEV (ERR_MODULE_NOT_FOUND) because content.bundle.mjs imports it
transitively via packages/content/category-classifier-llm.js. srv-mcp was
missing @sap-ai-sdk/foundation-models for the same reason.

Also adds scripts/check-bundle-externals-declared.cjs: a static guard that
parses every *.bundle.mjs in srv/srv-qa/srv-mcp and asserts each bare
@sap-ai-sdk/* and @sap/* external is declared in that module's package.json.
Wired into static-guards. 18 new Vitest tests covering the guard + a
regression test that would fail if the orchestration fix were reverted.
@jung-thomas
jung-thomas merged commit affaa48 into DEV Sep 28, 2026
4 of 5 checks passed
@jung-thomas
jung-thomas deleted the worktree-mcp-auth-multipackage branch September 28, 2026 23:57
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