Files
supabase/apps
Alaister Young df2a806dab fix(studio): plumb Request.signal through toWebHandler as req.on('close'|'aborted')
Pages-router handlers that stream (e.g. /api/ai/sql/generate-v4)
wire client-abort by subscribing to Node IncomingMessage events:

  const abortController = new AbortController()
  req.on('close', () => abortController.abort())
  req.on('aborted', () => abortController.abort())

The toWebHandler shim built a plain NextApiRequest-shaped object with
no EventEmitter surface, so those calls crashed at runtime with
'req.on is not a function' on every request.

Surface a minimal EventEmitter (on/off/once/emit/removeListener/
removeAllListeners) that only honours the two events studio actually
uses ('close', 'aborted'), both wired to request.signal's abort
event. Other event names are accepted but never fire - good enough
for the handlers we forward through this shim.
2026-05-11 15:07:21 +08:00
..