Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -624,17 +624,35 @@ Number of worker processes to spawn. Useful for utilizing multiple CPU cores.

### `requestTimeout`

Request timeout in milliseconds (Node) or seconds (Bun). Set to `0` to disable.
Sets the maximum time in milliseconds allowed to receive the entire request from the client (headers + body). Once the body is fully received, this timer is cancelled and the handler can run indefinitely. Set to `0` to disable.

For a hard end-to-end deadline, use [`requestDeadline`](#requestdeadline) instead.

```ts title="gateway.config.ts"
import { defineConfig } from "@graphql-hive/gateway";

export const gatewayConfig = defineConfig({
// Node:
requestTimeout: 30_000, // 30 seconds
});
```

### `requestDeadline`

Sets a hard end-to-end time limit in milliseconds for the entire request lifecycle, from connection to response completion. Unlike [`requestTimeout`](#requesttimeout), this timer is not cancelled when the request body is received - it runs until the response is finished. When the deadline is exceeded, the server responds with a 503 and closes the connection.

<Callout type="warning">

In Bun, streamed responses (e.g. defer/stream) are not covered by this
deadline. The timer only applies until the Response object is created; once
streaming begins, the body can continue past the deadline.

// Bun uses seconds instead of milliseconds:
requestTimeout: 30, // 30 seconds
</Callout>

```ts title="gateway.config.ts"
import { defineConfig } from "@graphql-hive/gateway";

export const gatewayConfig = defineConfig({
requestDeadline: 30_000, // 30 seconds
});
```

Expand Down
Loading