Registry / devops / grpc-health-check-ts

grpc-health-check-ts

JSON →
library1.0.2jsnpmunverified

TypeScript implementation of the gRPC health checking protocol (defined in grpc/grpc-proto). Version 1.0.2 provides generated ProtoBuf service definitions and a ready-to-use server/client for health checks. It replaces the outdated grpc-ts-health-check package and is compatible with the modern @grpc/grpc-js library. Unlike the predecessor, it does not depend on the deprecated grpc package and is fully typed for TypeScript projects. The package is minimal and focuses solely on the standard gRPC health check service (Check and Watch RPCs).

npm install grpc-health-check-ts
INSTALL
IMPORT
SIG · GRPC-HEALTH-CHECK-
G
grpc-health-check-ts
devopsjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

health
import { health } from 'grpc-health-check-ts'
const health = require('grpc-health-check-ts')
Package is ESM with TypeScript types; default export is the 'health' object containing the service definition.
HealthCheckRequest
import { HealthCheckRequest } from 'grpc-health-check-ts'
import { health } from 'grpc-health-check-ts'; health.HealthCheckRequest
Named exports for message types are available directly.
HealthCheckResponse
import { HealthCheckResponse } from 'grpc-health-check-ts'
import HealthCheckResponse from 'grpc-health-check-ts'
Named export, not default.

Creates a gRPC server using @grpc/grpc-js that implements the health check service. The server responds with SERVING status on both Check and Watch RPCs.

import { health, HealthCheckRequest, HealthCheckResponse } from 'grpc-health-check-ts'; import { Server, ServerCredentials } from '@grpc/grpc-js'; const server = new Server(); server.addService(health.service, { Check: (call: any, callback: any) => { callback(null, { status: 'SERVING' }); }, Watch: (call: any) => { call.write({ status: 'SERVING' }); call.end(); } }); server.bindAsync('0.0.0.0:50051', ServerCredentials.createInsecure(), (err, port) => { if (err) throw err; console.log(`gRPC health server on ${port}`); });
Debug
Known issues
breakingPackage is ESM-only. CommonJS require() will fail.
fix
Use dynamic import() or switch to ESM.
affects: >=1.0.0
gotchaThe package exports do not include a direct Server or Client implementation; only service definition and message types. You must implement the handler yourself.
fix
Provide your own Check and Watch handlers as shown in quickstart.
affects: *
deprecatedThe predecessor grpc.ts.health.check is deprecated and incompatible with @grpc/grpc-js. Do not use it.
fix
Use grpc-health-check-ts instead.
affects: all
gotchaTypeScript types may be incomplete; some gRPC Stream types are missing.
fix
Manually define missing types or wrap calls with any.
affects: 1.0.2
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
Using old package grpc.ts.health.check which depends on deprecated 'grpc' package.
fix
Uninstall grpc.ts.health.check and install grpc-health-check-ts. Update your imports to use @grpc/grpc-js.
TypeError: health.service is not a constructor
Incorrect import pattern trying to use health.service with new (it's an object, not class).
fix
Use server.addService(health.service, ...) as shown in quickstart.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
grpc-health-check-ts — npm install grpc-health-check-ts · libregistry