{"id":"420ad5b55550ed35","repo":"nestjs/nest","slug":"the-status-attribute-is-not-supported-by-the-grp","errorCode":null,"errorMessage":"The \"status\" attribute is not supported by the gRPC transport","messagePattern":"The \"status\" attribute is not supported by the gRPC transport","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/microservices/server/server-grpc.ts","lineNumber":65,"sourceCode":"  metadata: TMetadata;\n  sendMetadata: Function;\n  end: Function;\n  write: Function;\n  on: Function;\n  off: Function;\n  emit: Function;\n}\n\n/**\n * @publicApi\n */\nexport class ServerGrpc extends Server<never, never> {\n  public transportId: TransportId = Transport.GRPC;\n  protected readonly url: string;\n  protected grpcClient: GrpcServer;\n\n  get status(): never {\n    throw new Error(\n      'The \"status\" attribute is not supported by the gRPC transport',\n    );\n  }\n\n  constructor(private readonly options: Readonly<GrpcOptions>['options']) {\n    super();\n    this.url = this.getOptionsProp(options, 'url') || GRPC_DEFAULT_URL;\n\n    const protoLoader =\n      this.getOptionsProp(options, 'protoLoader') || GRPC_DEFAULT_PROTO_LOADER;\n\n    grpcPackage = this.loadPackage('@grpc/grpc-js', ServerGrpc.name, () =>\n      require('@grpc/grpc-js'),\n    );\n    grpcProtoLoaderPackage = this.loadPackage(\n      protoLoader,\n      ServerGrpc.name,\n      () =>","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/nestjs/nest/blob/6ec0e2783d15290732447f304d8549b591b9749e/packages/microservices/server/server-grpc.ts#L47-L83","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Do not read status on a ServerGrpc; use gRPC Health Checking (grpc.health.v1) via @grpc/grpc-js health check service instead.","In generic code, branch on the transport type and skip status for Transport.GRPC.","Expose a custom readiness signal (e.g. after listen() callback) for gRPC rather than relying on the status getter."],"exampleFix":"// before\nconst server = new ServerGrpc(options);\nserver.status.subscribe(s => updateReady(s)); // throws\n\n// after\nconst server = new ServerGrpc(options);\n// use grpc health check service, or signal readiness from the listen() callback\nawait new Promise<void>(res => server.listen(() => res()));\nsetReady(true);","handlingStrategy":"type-guard","validationCode":"function readStatusSafe(server: any) {\n  if (server instanceof ServerGrpc) return undefined; // unsupported\n  return server.status;\n}\nconst status$ = readStatusSafe(server);","typeGuard":"import { ServerGrpc } from '@nestjs/microservices';\nconst hasGrpcStatus = (s: any): boolean => s instanceof ServerGrpc;\n// For gRPC, use grpc Health Checking instead of the status getter.","tryCatchPattern":"// Avoid the getter entirely for gRPC; branch by type.\nif (!(server instanceof ServerGrpc)) {\n  server.status.subscribe(s => updateReady(s));\n} else {\n  // set up grpc.health.v1 health check service\n}","preventionTips":["Never read status on a ServerGrpc; the type is `never`.","Use gRPC Health Checking for readiness/liveness.","Branch readiness probes by transport type."],"tags":["grpc","server","status","api-misuse","typescript"],"analyzedSha":"6ec0e2783d15290732447f304d8549b591b9749e","analyzedAt":"2026-08-03T17:42:23.673Z","schemaVersion":2}