Skip to content
Latchkey

gRPC "DEADLINE_EXCEEDED" in CI

gRPC status 4 DEADLINE_EXCEEDED means the client gave the call a deadline and the server did not finish in time. The connection may be fine; the work (or the cold start) just outlasted the timeout.

What this error means

A call fails with "4 DEADLINE_EXCEEDED: Deadline exceeded" in CI, often only on the first request while the server warms up, then passes locally with a longer timeout.

gRPC
Error: 4 DEADLINE_EXCEEDED: Deadline exceeded
    at Object.callErrorFromStatus (.../call.js)

Common causes

A deadline shorter than cold-start latency

The first call hits a server still initializing (JIT, connection pools, migrations), and the default or tight deadline elapses before it responds.

A genuinely slow handler or downstream

The RPC does real work, or waits on a dependency that is slow in CI, exceeding the deadline.

How to fix it

Set a realistic deadline and warm the server

  1. Give CI calls a deadline that accounts for cold start.
  2. Issue a warmup call (health check) before the timed assertions.
  3. Investigate the handler if the deadline is already generous.
JavaScript
const deadline = new Date(Date.now() + 10_000); // 10s for CI cold start
client.getUser({ id: '1' }, { deadline }, cb);

Wait for health before timing calls

Block on the standard health service so the first real call is not racing startup.

Terminal
grpcurl -plaintext localhost:50051 grpc.health.v1.Health/Check

How to prevent it

  • Account for CI cold start when choosing deadlines.
  • Warm the server with a health check before timed assertions.
  • Profile slow handlers rather than only raising deadlines.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →