fix(api): lazy-load node-pty to prevent API crash on missing native binary #525

Merged
jason.woltje merged 2 commits from fix/api-node-pty-crash into main 2026-02-26 13:46:27 +00:00

2 Commits

Author SHA1 Message Date
a7fbc1ccc8 fix(api): fix lint errors in lazy node-pty import types
All checks were successful
ci/woodpecker/push/api Pipeline was successful
Use proper import type instead of inline import() type annotations
that violate @typescript-eslint/consistent-type-imports rule.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 07:45:36 -06:00
d18cf44546 fix(api): lazy-load node-pty to prevent API crash when native binary is missing
node-pty requires a compiled native addon (.node binary) that may not
be available in all Docker environments. The eager import crashed the
entire API at startup. Changed to dynamic import() in onModuleInit()
so the service degrades gracefully — terminal sessions are disabled
but all other API functionality works.

Also added explicit node-gyp rebuild to Dockerfile deps stage since
pnpm may skip postinstall scripts for native addons.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 07:44:47 -06:00