Registry /
devops / psb_interop-apis-bc-grpc-sync-client-lib
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.
GrpcSyncClient
✓ import { GrpcSyncClient } from '@mojaloop-poc/interop-apis-bc-grpc-sync-client-lib'
✗ const GrpcSyncClient = require('@mojaloop-poc/interop-apis-bc-grpc-sync-client-lib')
ESM only; use dynamic import for CJS.
createSyncClient
✓ import { createSyncClient } from '@mojaloop-poc/interop-apis-bc-grpc-sync-client-lib'
✗ import { createSyncClient } from 'grpc-sync-client-lib'
Full package name includes scoped prefix.
type GrpcSyncClientConfig
✓ import type { GrpcSyncClientConfig } from '@mojaloop-poc/interop-apis-bc-grpc-sync-client-lib'
✗ import { GrpcSyncClientConfig } from '@mojaloop-poc/interop-apis-bc-grpc-sync-client-lib'
This is a type; use import type to avoid runtime inclusion.
Creates a gRPC sync client with insecure credentials and makes a sample unary RPC call.
import { createSyncClient, GrpcSyncClient } from '@mojaloop-poc/interop-apis-bc-grpc-sync-client-lib';
import * as grpc from '@grpc/grpc-js';
const config: GrpcSyncClientConfig = {
serviceUrl: process.env.SYNC_SVC_URL || 'localhost:50051',
credentials: grpc.credentials.createInsecure(),
};
const client = createSyncClient(config);
async function callRpc(): Promise<void> {
try {
const response = await client.someRpc({ requestData: 'test' });
console.log('RPC response:', response);
} catch (err) {
console.error('RPC failed:', err);
}
}
callRpc();
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Using CommonJS require() on an ESM-only package.
fixSwitch to import statement or use dynamic import().
Cannot find module '@mojaloop-poc/interop-apis-bc-grpc-sync-client-lib'
Package not installed or wrong import path.
fixRun 'npm install @mojaloop-poc/interop-apis-bc-grpc-sync-client-lib' and verify the import path.
TypeError: client.someRpc is not a function
Attempting to call a method that does not exist on the client object.
fixCheck the generated gRPC proto definition for available RPC methods.
Audit
Dependencies
@grpc/grpc-jsrequiredCore gRPC client library
protobufjsrequiredProtocol buffer serialization