Upstream Cancellation

This feature enables you to cancel the upstream HTTP requests when the client cancels the downstream GraphQL request. This can be useful when you want to save resources on your server and the services.

There is also Execution Cancellation that stops the execution, but it doesn’t stop ongoing HTTP requests. This seperately allows you to stop the HTTP requests by hooking into fetch.

Enable Upstream Cancellation

gateway.config.ts
import { defineConfig } from '@graphql-hive/gateway'
 
export const gatewayConfig = defineConfig({
  upstreamCancellation: true
})