Conversation
The default import introduced in PR stoplightio#2752 compiles under module:commonjs + esModuleInterop:false to 'cluster.default.isPrimary', but cluster.default is undefined at runtime because the cluster module has no default export. This causes 'TypeError: Cannot read properties of undefined (reading isPrimary)' when starting Prism 5.15+ in any mode (regression tracked in stoplightio#2763). Use a namespace import with a type cast to restore correct runtime behavior while satisfying the Cluster type from @types/node 24+. Verified: - cluster.isPrimary === true (was undefined) - cluster.setupPrimary is a function - cluster.fork is a function Fixes stoplightio#2763
|
Hi maintainers — gentle ping on this PR. It fixes a startup regression (#2763) where Prism 5.15+ crashes with The fix is a 10-line change in a single file ( Would appreciate a review when you have a moment. Thanks! |
|
Hi maintainers — gentle ping on this PR. It restores the cluster namespace import to fix a startup regression. CI checks pass and the PR is mergeable. Would appreciate a review when you have a moment. Thanks! |
|
Ping: this is a 10-line regression fix for Prism 5.15+ startup failure (#2763). CI is green. Would appreciate a review when you have a moment — the fix restores the namespace import style that the Node 18→24 bump accidentally broke. |
Problem
PR #2763 reports that Prism 5.15+ fails to start in any mode (mock, proxy, etc.):
Root cause
PR #2752 (Node 18 → 24 bump) changed the cluster import style from
namespace to default:
Under
module: commonjs+esModuleInterop: false, the default importcompiles to
node_cluster_1.default.isPrimary, butnode_cluster_1.defaultis
undefinedat runtime because the cluster module has no default export.The namespace import compiles to
cluster.isPrimary, which works becausethe module IS the singleton Cluster instance.
Fix
Restore the namespace import with a type cast to satisfy the Cluster type
from
@types/node24+ (which only exposes the Cluster interface via thedefault export). The cast is erased at compile time; runtime behavior is
identical to a plain namespace import.
Verification
Pre-existing TypeScript errors in
paths.ts,forwarder/index.ts, andvalidator/index.ts(unrelated to this fix) remain unchanged.Fixes #2763