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
Owner

Summary

  • Converts node-pty from eager to lazy in so the API starts even when the native binary is unavailable
  • Adds explicit to Dockerfile deps stage since pnpm may skip postinstall scripts
  • Terminal sessions gracefully degrade (disabled with warning log) instead of crashing the entire API

Test plan

  • All 23 terminal service tests pass
  • All 3303 API tests pass
  • Typecheck clean
  • Lint clean (--max-warnings=0)

🤖 Generated with Claude Code

## Summary - Converts node-pty from eager to lazy in so the API starts even when the native binary is unavailable - Adds explicit to Dockerfile deps stage since pnpm may skip postinstall scripts - Terminal sessions gracefully degrade (disabled with warning log) instead of crashing the entire API ## Test plan - [x] All 23 terminal service tests pass - [x] All 3303 API tests pass - [x] Typecheck clean - [x] Lint clean (--max-warnings=0) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jason.woltje added 2 commits 2026-02-26 13:46:19 +00:00
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>
fix(api): fix lint errors in lazy node-pty import types
All checks were successful
ci/woodpecker/push/api Pipeline was successful
a7fbc1ccc8
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>
jason.woltje merged commit ad99cb9a03 into main 2026-02-26 13:46:27 +00:00
Sign in to join this conversation.