@lensmcp/cluster 1.16.22 → 1.16.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../../../libs/cluster/src/executors/gateway/runtime/proxy.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,EAAW,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA8BhD,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IACxH,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;IACnI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,GAAG,IAAI,CAAC;IACrG,KAAK,CAAC,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,O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KAAK,IAAI,GAAG,IAAI,CAAC;IACnI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,GAAG,IAAI,CAAC;IACrG,KAAK,CAAC,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1F,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC,KAAK,GAAG,OAAO,YAAY,EAAE,KAAK,CAAC;IACzE,aAAa,IAAI,IAAI,CAAC;IACtB,UAAU,IAAI,IAAI,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,GAAG,UAAU,CAsTtG"}
@@ -110,6 +110,11 @@ function createProxy(rt, obs, svcLayer) {
110
110
  agent: agentForTarget(target),
111
111
  };
112
112
  }
113
+ // An h2 ServerResponse whose stream faults (a RST from the client, a
114
+ // `res.destroy(err)` below) emits 'error'; UNHANDLED, that throws and can
115
+ // escalate to tear the whole h2 session down — the very "burst" symptom.
116
+ // A no-op listener keeps the fault local to THIS stream. (Harmless on h1.)
117
+ res.on('error', () => { });
113
118
  const upstreamReq = mod.request(opts, (upstreamRes) => {
114
119
  cbs.onResponse();
115
120
  if (res.headersSent || res.writableEnded || res.destroyed) {
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../../libs/cluster/src/executors/gateway/runtime/server.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAK/D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAkB,qBAAqB,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AA0BxH;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,KAAK,EAAE,GAAG,gBAAgB,CA4ChF;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAkPxB"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../../libs/cluster/src/executors/gateway/runtime/server.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAK/D,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAkB,qBAAqB,EAAe,KAAK,EAAE,MAAM,SAAS,CAAC;AA0BxH;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,KAAK,EAAE,GAAG,gBAAgB,CA4ChF;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,aAAa,CAAC,CAmRxB"}
@@ -286,10 +286,44 @@ async function startGateway(options, context) {
286
286
  // because node-http-proxy emits connection-specific headers that are illegal in h2.
287
287
  const server = pem
288
288
  ? // eslint-disable-next-line @typescript-eslint/no-require-imports
289
- require('node:http2').createSecureServer({ key: pem, cert: pem, allowHTTP1: true }, (req, res) => handler(req, res))
289
+ require('node:http2').createSecureServer({
290
+ key: pem,
291
+ cert: pem,
292
+ allowHTTP1: true,
293
+ // A full Vite dev-app reload streams TENS of MB of transformed ESM
294
+ // over ONE h2 session. Node's default `maxSessionMemory` is 10 MB —
295
+ // cross it and the session RSTs its streams / sends GOAWAY, which the
296
+ // browser reports as a BURST of ERR_HTTP2_PROTOCOL_ERROR (every
297
+ // in-flight module fails at the same instant). Raise the ceiling and
298
+ // the per-stream/peer limits to dev-front-door proportions.
299
+ maxSessionMemory: 512,
300
+ settings: { maxConcurrentStreams: 512 },
301
+ peerMaxConcurrentStreams: 512,
302
+ }, (req, res) => handler(req, res))
290
303
  : http.createServer(handler);
291
304
  server.on('upgrade', upgrade);
292
305
  server.on('error', (err) => console.error(`[gateway] port ${port}: ${err.code}`));
306
+ // h2 SESSION resilience: without a `sessionError` handler ANY session-level
307
+ // fault (a client GOAWAY mid-burst, a flood-protection trip, a decode error)
308
+ // is unhandled → Node tears the session down, failing EVERY sibling stream at
309
+ // once. Handle it so ONE bad session logs + dies alone, never throwing and
310
+ // never taking the process (or other clients' sessions) with it. `session`
311
+ // errors are surfaced BOTH per-session and (unhandled) as `sessionError`.
312
+ const isH2 = pem != null;
313
+ if (isH2) {
314
+ const h2 = server;
315
+ h2.on('session', (session) => {
316
+ session.on('error', (err) => {
317
+ const code = err.code ?? err.message;
318
+ console.warn(`[gateway] h2 session error (${code}) — dropping this session only`);
319
+ if (!session.destroyed)
320
+ session.destroy();
321
+ });
322
+ });
323
+ h2.on('sessionError', (err) => {
324
+ console.warn(`[gateway] h2 sessionError: ${err.code ?? err.message}`);
325
+ });
326
+ }
293
327
  await new Promise((resolve) => {
294
328
  server.listen(port, () => {
295
329
  const actual = server.address()?.port ?? port;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensmcp/cluster",
3
- "version": "1.16.22",
3
+ "version": "1.16.24",
4
4
  "description": "Run your Nx workspace as a local production cluster: pods on unix sockets with true HMR, one https gateway with per-project domains, scale-from-zero, autoscale, idle-kill, local-CA TLS — observed by the LensMCP lens.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -65,8 +65,8 @@
65
65
  }
66
66
  },
67
67
  "dependencies": {
68
- "@lensmcp/node-instrumentation": "1.16.22",
69
- "@lensmcp/nx-plugin": "1.16.22",
68
+ "@lensmcp/node-instrumentation": "1.16.24",
69
+ "@lensmcp/nx-plugin": "1.16.24",
70
70
  "fork-ts-checker-webpack-plugin": "^9.0.0",
71
71
  "glob": "^11.0.0",
72
72
  "http-proxy": "^1.18.0",