Registry / database / ydb-sdk

ydb-sdk

JSON →
library5.11.1jsnpmunverified

Official Node.js bindings for YDB (Yandex Database) API over gRPC. Current stable version is 5.11.1, with a moderate release cadence. This SDK provides native TypeScript types and supports multiple authentication methods (access token, metadata, service account key, anonymous). It is the primary SDK for YDB on Node.js, differentiating itself with first-class gRPC support and integration with Yandex.Cloud IAM. Requires Node.js >= 12 and npm >= 6.

npm install ydb-sdk
INSTALL
IMPORT
SIG · YDB-SDK
Y
ydb-sdk
databasejavascriptv5.11.1
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.

ydb-sdk
import { Driver, getCredentialsFromEnv, Logger } from 'ydb-sdk';
const ydb = require('ydb-sdk');
ESM-only since v3; named exports are Driver, getCredentialsFromEnv, etc. CommonJS require() will fail unless using Node.js >= 12 with --experimental-modules.
Driver
import { Driver } from 'ydb-sdk';
import Driver from 'ydb-sdk';
Driver is a named export, not default export.
Types
import { TypedData, typedData } from 'ydb-sdk';
import { Types } from 'ydb-sdk';
TypeScript types are exported separately; use 'TypedData' and 'typedData' for typed operations.

Connects to YDB using environment credentials, executes a simple query, and logs the result.

import { Driver, getCredentialsFromEnv, Logger, ydb } from 'ydb-sdk'; const logger = new Logger('my-app'); const driver = new Driver({ endpoint: 'grpcs://your.cloud.endpoint.hostname:2135', database: '/your/database/path', authService: getCredentialsFromEnv(), logger, }); async function run() { const result = await driver.tableClient.withSession(async (session) => { const query = `SELECT 1 AS value`; const { resultSets } = await session.executeQuery(query); return resultSets[0].rows; }); console.log(result); } run().catch(console.error);
Debug
Known issues
breakingDriver constructor parameters have changed: 'authService' is now required, and 'endpoint' must include port.
fix
Update constructor calls to provide authService and include port in endpoint.
affects: >=5.0.0
deprecatedgetCredentialsFromEnv() is deprecated in favor of explicit credential providers.
fix
Use IamAuthService, TokenAuthService, etc., directly.
affects: >=5.10.0
gotchagRPC connection may hang if timeout is not set; default is infinite.
fix
Set 'grpc.Timeout' option in driver config or use context with timeout.
affects: *
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '.../node_modules/ydb-sdk/build/src/...'
Build artifacts missing; package not built after install.
fix
Run 'npm run build' in project root after installation.
TypeError: Class constructor Driver cannot be invoked without 'new'
Missing 'new' keyword when instantiating Driver.
fix
Use 'new Driver(options)'.
UnhandledPromiseRejectionWarning: Error: CANNOT_INITIALIZE_DRIVER: No auth provider specified
Driver created without authService or missing credentials.
fix
Set authService using getCredentialsFromEnv() or explicit provider.
Upgrade
Version history
5.11.1latest on npm
Audit
Dependencies
@yandex-cloud/nodejs-sdkrequiredPeer dependency for Yandex.Cloud authentication and API usage
Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
ydb-sdk — npm install ydb-sdk · libregistry