Apollo Server v4 resolver continues after client disconnect
0 reputation · 24 Oct 2021, 08:58 UTC
Apollo Server v4 resolver continues after client disconnect
Goal: determine whether Apollo Server v4 automatically halts resolver execution when the client aborts the HTTP request, or whether each resolver must explicitly forward the request abort signal to downstream data sources.
Apollo Server v4 exposes the Node HTTP request in context, so resolvers can read req.signal. Because GraphQL execution cancellation is not specified by the GraphQL spec, abort behavior depends on the Server integration package and Node.js version. AbortSignal.timeout is only available in newer Node.js releases, so combining request cancellation with operation deadlines may require version-specific handling.
- Does Apollo Server v4 reject in-flight resolver promises when
req.signalaborts? - Must resolvers manually pass
req.signalto database clients or fetch calls? - How should a resolver combine
req.signalwithAbortSignal.timeoutfor an operation-level deadline?