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.fixPin 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.fixUse 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.fixEnsure @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.
fixSet "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.
fixEnsure 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.
fixUse `import * as grpc from '@grpc/grpc-js'` instead of `import grpc from '@grpc/grpc-js'`.
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.