Skip to content

fix(api/mcp): unbreak Railway deploy — strip-types incompat in rate-limit.ts#6

Merged
alextnetto merged 1 commit into
mainfrom
fix/strip-types-rate-limit
May 10, 2026
Merged

fix(api/mcp): unbreak Railway deploy — strip-types incompat in rate-limit.ts#6
alextnetto merged 1 commit into
mainfrom
fix/strip-types-rate-limit

Conversation

@alextnetto
Copy link
Copy Markdown
Member

Summary

Production has been serving stale code since 2026-05-09 17:51 PT because every Railway deploy attempt has failed with:

SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript parameter property is not supported in strip-only mode
file:///app/apps/api/mcp/rate-limit.ts:39
  constructor(
    private readonly limit: number,
                     ^^^^^^^^^^^^^

npm run start boots via node --experimental-strip-types, which strips type annotations but cannot emit the field assignments that parameter properties imply. The class fails to load, the process exits 1, the healthcheck never goes green on the new container, so Railway keeps the previous (working) container in front of traffic. Result: ~18 failed deploys over 18 hours, all silent because the old version kept answering /health 200.

Fix

Promote limit and windowMs to explicit fields and assign them in the constructor body. No behavior change; same shape on disk.

Verified locally

  • node --experimental-strip-types loads rate-limit.ts cleanly (OK: [ 'RateLimiter' ])
  • Booting the API end-to-end gets past TS loading and reaches DB connect (only fails locally because no Postgres on :5432)
  • Pre-push: typecheck + lint + format + 158 tests + mcp bundle — all green

Test plan

  • CI green
  • Watch Railway deploy after merge — should turn the new container green for the first time since 2026-05-09
  • curl https://pagent.up.railway.app/health returns {"ok":true,"db":"ok"} (the new shape)

…fields

Node's --experimental-strip-types mode (used by `npm run start`) does
not support TypeScript parameter properties — the production start
script crashes immediately with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX.

This silently broke every Railway deploy since 2026-05-09 17:51 PT;
healthcheck on the old container kept passing, so traffic kept hitting
the previous successful build.

Promote `limit` and `windowMs` to explicit fields and assign them
manually in the constructor body.
@alextnetto alextnetto merged commit f912f84 into main May 10, 2026
1 check passed
@alextnetto alextnetto deleted the fix/strip-types-rate-limit branch May 10, 2026 19:09
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