Registry / devops / rootle-grpc-interceptor

rootle-grpc-interceptor

JSON →
library0.0.4jsnpmunverified

A TypeScript-based gRPC client interceptor that integrates with Rootle log API for logging gRPC errors, currently at stable version 0.0.4. It allows specifying request fields to use as referer and user-agent via an InterceptorRequestSources interface. The interceptor is used as a custom gRPC interceptor passed to a gRPC client, enabling structured error logging. Compared to manual logging, it provides a drop-in solution for Rootle logging without modifying client code.

npm install rootle-grpc-interceptor
INSTALL
IMPORT
SIG · ROOTLE-GRPC-INTERC
R
rootle-grpc-interceptor
devopsjavascriptv0.0.4
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.

default (Rootle)
import Rootle from 'rootle'
const Rootle = require('rootle')
Rootle is ESM-only; use default import.
default (Interceptor)
import Interceptor from 'rootle-grpc-interceptor'
const { Interceptor } = require('rootle-grpc-interceptor')
Package exports a single default interceptor function.
InterceptorRequestSources
import type { InterceptorRequestSources } from 'rootle-grpc-interceptor'
import { InterceptorRequestSources } from 'rootle-grpc-interceptor'
Only a type; use 'import type' to avoid runtime import errors.

Shows how to instantiate a Rootle logger with API key and service name, then use the interceptor in a gRPC client.

import * as grpc from '@grpc/grpc-js'; import Rootle from 'rootle'; import Interceptor from 'rootle-grpc-interceptor'; const logger = new Rootle( process.env.ROOTLE_API_KEY ?? '', 'billing-Lambda', { referer: 'client', useragent: 'agent' } ); const client = new SomeGrpcClient( 'localhost:6000', grpc.credentials.createInsecure(), { interceptors: [Interceptor] } );
Debug
Known issues
breakingRootle interceptor expects a field named exactly as provided in sources; misspelling causes referer/useragent to be undefined.
fix
Verify field names in request object match the keys passed to Rootle constructor (case-sensitive).
affects: >=0.0.4
gotchaThe interceptor may not log errors if the client does not call the method or if the method succeeds.
fix
The interceptor only adds logging; it does not affect request/response flow; ensure error loggers are properly configured.
affects: >=0.0.4
deprecatedPackage version 0.0.4 may not be stable; minor version suggests it is early-stage.
fix
Check for newer versions or consider locking version to avoid unexpected changes.
affects: 0.0.4
Errors
Common errors & fixes
TypeError: Rootle is not a constructor
Default import used incorrectly or runtime mixing CJS/ESM.
fix
Use `import Rootle from 'rootle'` (ESM) or `const Rootle = require('rootle').default` (CJS).
Cannot find module 'rootle-grpc-interceptor'
Package not installed or typo.
fix
Run `npm install rootle-grpc-interceptor` and ensure import path is correct.
Argument of type 'typeof import("...")' is not assignable to 'Interceptor'
TypeScript interceptor type mismatch.
fix
Ensure the imported interceptor is used as a value, not a type; pass `[Interceptor]` directly.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
rootlerequiredCore logging library that this interceptor wraps; required to instantiate a Rootle logger.
@grpc/grpc-jsrequiredgRPC implementation for Node.js that provides interceptor interfaces; required at runtime.
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
rootle-grpc-interceptor — npm install rootle-grpc-interceptor · libregistry