Registry / devops / grpc-es-bridge

grpc-es-bridge

JSON →
library0.2.0jsnpmunverified

A lightweight adapter (v0.2.0) that bridges protoc-gen-es generated stubs designed for a @connectrpc/connect runtime with the grpc-js implementation. It enables developers to use type-safe, declarative client methods from protoc-gen-es while leveraging grpc-js for networking. The package also includes a connectrpc submodule that provides a Promise-based client interface similar to connectrpc. Key differentiators: it fills a specific niche for users who want the ergonomics of protoc-gen-es stubs but need to connect to existing gRPC servers using grpc-js. Release cadence is not yet established; peer dependencies are @bufbuild/protobuf@^2, @grpc/grpc-js@^1, and @connectrpc/connect@^2. Ships TypeScript types.

npm install grpc-es-bridge
INSTALL
IMPORT
SIG · GRPC-ES-BRIDGE
G
grpc-es-bridge
devopsjavascriptv0.2.0
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.

createGrpcBridgeClient
import { createGrpcBridgeClient } from 'grpc-es-bridge'
const createGrpcBridgeClient = require('grpc-es-bridge');
Package is ESM-only; CommonJS require will fail if the consumer does not have ESM support.
createConnectRpcClient
import { createConnectRpcClient } from 'grpc-es-bridge/connectrpc'
import { createConnectRpcClient } from 'grpc-es-bridge';
The Promise-based client is exported from a subpath 'grpc-es-bridge/connectrpc', not the main entry.
GrpcBridgeClient
import type { GrpcBridgeClient } from 'grpc-es-bridge'
import { GrpcBridgeClient } from 'grpc-es-bridge';
GrpcBridgeClient is a type, not a runtime value; use 'import type' to avoid bundling issues.

Creates a gRPC client from a protoc-gen-es generated service definition using grpc-es-bridge, then makes a unary RPC call with a callback.

import * as grpc from '@grpc/grpc-js'; import { createGrpcBridgeClient } from 'grpc-es-bridge'; import { ElizaService } from './gen/proto/eliza_pb.js'; const ElizaServiceClient = createGrpcBridgeClient(ElizaService); const address = process.env.GRPC_ADDRESS ?? 'localhost:50051'; const credentials = grpc.credentials.createInsecure(); const client = new ElizaServiceClient(address, credentials); client.say({ sentence: process.argv[2] ?? 'Hello' }, (error, response) => { if (error) console.error(error); else console.log('Response:', response); });
Debug
Known issues
gotchaThe package is in early development (v0.2.0); API may change without notice.
fix
Pin to exact version and review changelog before upgrading.
affects: >=0.0.0
gotchaThe connectrpc subpath export (grpc-es-bridge/connectrpc) may not be available in older versions or custom bundler configurations.
fix
Use import from main entry if available, or upgrade to >=0.2.0.
affects: <0.2.0 || >=0.0.0
gotchaRequires all three peer dependencies; missing any one will cause runtime errors.
fix
Ensure @bufbuild/protobuf, @grpc/grpc-js, and @connectrpc/connect are installed.
affects: >=0.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Package is ESM-only but the consuming project is CommonJS.
fix
Set "type": "module" in package.json or use dynamic import().
Error: Cannot find module 'grpc-es-bridge/connectrpc'
The subpath is not resolved because the package's exports field is misconfigured or the bundler does not support subpath exports.
fix
Ensure bundler (e.g., webpack, Rollup) supports the 'exports' field in package.json, or use older resolution via 'grpc-es-bridge/connectrpc'. Upgrade to Node 14+ or use a bundler that supports subpath exports.
TypeError: grpc.credentials.createInsecure is not a function
The @grpc/grpc-js import is incorrectly used; likely missing the default import.
fix
Use `import * as grpc from '@grpc/grpc-js'` instead of `import grpc from '@grpc/grpc-js'`.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
@bufbuild/protobufrequiredRequired for protobuf types and serialization used by protoc-gen-es generated stubs.
@grpc/grpc-jsrequiredCore gRPC implementation for handling networking and client creation.
@connectrpc/connectrequiredProvides the connectrpc interface and type definitions used by the helper module.
Agent activity
6 hits · last 30 days
node
6
Resources
grpc-es-bridge — npm install grpc-es-bridge · libregistry