Skip to content

fix(den-api): build @openwork/types and @openwork/automations in the native build - #3527

Merged
benjaminshafii merged 1 commit into
devfrom
fix/den-api-native-build-automations
Aug 4, 2026
Merged

fix(den-api): build @openwork/types and @openwork/automations in the native build#3527
benjaminshafii merged 1 commit into
devfrom
fix/den-api-native-build-automations

Conversation

@benjaminshafii

@benjaminshafii benjaminshafii commented Aug 4, 2026

Copy link
Copy Markdown
Member

Problem

Production den-api (Render native build, /opt/render/project/src/...) crashes at boot since #3466 shipped:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../ee/apps/den-api/node_modules/@openwork/types/dist/automations.js'
imported from .../ee/apps/den-api/dist/routes/automations/index.js

This is why Automations is currently unusable in prod.

Cause

#3466 added the ./automations subpath to @openwork/types and the new @openwork/automations package. Both resolve their node/default export conditions to tsup-built dist/ files — the first exports in these packages that require a build step. packaging/docker/Dockerfile.den was correctly updated to build them, but Render does not use that Dockerfile: it runs the native build (ee/apps/den-api/scripts/build.mjs), which pre-builds email/install-config/connect-link/enterprise-mcp-client/den-db but not these two packages. tsc cannot catch it (it resolves the types condition to src/), and bun/tsx tests resolve bun/development to src/ — the failure only exists at plain-Node boot.

Fix

Build @openwork/types then @openwork/automations (types first — automations depends on it) in build.mjs, with matching build:* scripts following the existing pattern. 4-line diff. Redundant-but-harmless for the Docker path.

Validation

Build-tooling change — no app-runtime behavior change, so no testkit tape; verified by running the production build path directly:

  • pnpm install — passed
  • rm -rf packages/types/dist packages/automations/dist && pnpm --dir ee/apps/den-api run build — exit 0, both tsup builds ran
  • packages/types/dist/automations.js and packages/automations/dist/index.js exist after build
  • From ee/apps/den-api: node --input-type=module -e "await import('@openwork/types/automations'); await import('@openwork/automations')" — prints resolve-ok (reproduces the exact prod resolution; fails on current dev)

After merge

Redeploy den-api on Render (manual redeploy lever added in be9a95cea). A follow-up draft PR adds a CI job so this class of break is caught on PRs.

cc @reachjalil

…native build

The Automations feature (#3466) added @openwork/types/automations and
@openwork/automations, whose node/default export conditions resolve to
tsup-built dist/ files. Dockerfile.den was updated to build them, but the
native build path (scripts/build.mjs) that Render uses was not, so the
deployed den-api crashes at boot:

  ERR_MODULE_NOT_FOUND: .../@openwork/types/dist/automations.js
  imported from dist/routes/automations/index.js

Build both packages (types first; automations depends on it) before the
existing workspace package builds.
@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-app Ready Ready Preview Aug 4, 2026 9:29pm
openwork-den Ready Ready Preview Aug 4, 2026 9:29pm
openwork-den-worker-proxy Ready Ready Preview Aug 4, 2026 9:29pm
openwork-landing Ready Ready Preview, v0 Aug 4, 2026 9:29pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
openwork-diagnostics Skipped Skipped Aug 4, 2026 9:29pm

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warden security clearance: clear. No new security issues found in this diff (416cccabb9dff29db8943fce321e2ba84b0407be). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@benjaminshafii
benjaminshafii merged commit 33d7667 into dev Aug 4, 2026
27 checks passed
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