nestjs/nest · error · Error

The "status" attribute is not supported by the gRPC transpor

Error message

The "status" attribute is not supported by the gRPC transport

What it means

Thrown by the ServerGrpc.status getter. ServerGrpc declares `get status(): never { throw new Error(...) }` because the gRPC transport does not produce a connection-status stream the way TCP/Redis/RMQ/MQTT/NATS do (those emit Status enum values through a ReplaySubject). Accessing the status property on a gRPC server is therefore an explicit compile-time-and-runtime guard that this API is unsupported for gRPC — the `: never` return type also makes TypeScript flag downstream usage.

Source

Thrown at packages/microservices/server/server-grpc.ts:65

  metadata: TMetadata;
  sendMetadata: Function;
  end: Function;
  write: Function;
  on: Function;
  off: Function;
  emit: Function;
}

/**
 * @publicApi
 */
export class ServerGrpc extends Server<never, never> {
  public transportId: TransportId = Transport.GRPC;
  protected readonly url: string;
  protected grpcClient: GrpcServer;

  get status(): never {
    throw new Error(
      'The "status" attribute is not supported by the gRPC transport',
    );
  }

  constructor(private readonly options: Readonly<GrpcOptions>['options']) {
    super();
    this.url = this.getOptionsProp(options, 'url') || GRPC_DEFAULT_URL;

    const protoLoader =
      this.getOptionsProp(options, 'protoLoader') || GRPC_DEFAULT_PROTO_LOADER;

    grpcPackage = this.loadPackage('@grpc/grpc-js', ServerGrpc.name, () =>
      require('@grpc/grpc-js'),
    );
    grpcProtoLoaderPackage = this.loadPackage(
      protoLoader,
      ServerGrpc.name,
      () =>

View on GitHub (pinned to 6ec0e2783d)

Solutions

  1. Do not read status on a ServerGrpc; use gRPC Health Checking (grpc.health.v1) via @grpc/grpc-js health check service instead.
  2. In generic code, branch on the transport type and skip status for Transport.GRPC.
  3. Expose a custom readiness signal (e.g. after listen() callback) for gRPC rather than relying on the status getter.

Example fix

// before
const server = new ServerGrpc(options);
server.status.subscribe(s => updateReady(s)); // throws

// after
const server = new ServerGrpc(options);
// use grpc health check service, or signal readiness from the listen() callback
await new Promise<void>(res => server.listen(() => res()));
setReady(true);
Defensive patterns

Strategy: type-guard

Validate before calling

function readStatusSafe(server: any) {
  if (server instanceof ServerGrpc) return undefined; // unsupported
  return server.status;
}
const status$ = readStatusSafe(server);

Type guard

import { ServerGrpc } from '@nestjs/microservices';
const hasGrpcStatus = (s: any): boolean => s instanceof ServerGrpc;
// For gRPC, use grpc Health Checking instead of the status getter.

Try / catch

// Avoid the getter entirely for gRPC; branch by type.
if (!(server instanceof ServerGrpc)) {
  server.status.subscribe(s => updateReady(s));
} else {
  // set up grpc.health.v1 health check service
}

Prevention

When it happens

Trigger: Reading server.status on a ServerGrpc instance, or calling a generic health/status reporter that does `if (server.status) ...` or subscribes to server.status across all transports including gRPC. Code written for the TCP/Redis status API reused on the gRPC server.

Common situations: A unified readiness/liveness probe that iterates servers and reads status. Library code that assumes every Server has a meaningful status Observable. Copy-pasting TCP/Redis status wiring into a gRPC setup.

Related errors


AI-assisted analysis of nestjs/nest@6ec0e2783d (2026-08-03). Data as JSON: /data/errors/420ad5b55550ed35.json. Report an issue: GitHub.