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);
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.
fixRun 'npm run build' in project root after installation.
TypeError: Class constructor Driver cannot be invoked without 'new'
Missing 'new' keyword when instantiating Driver.
fixUse 'new Driver(options)'.
UnhandledPromiseRejectionWarning: Error: CANNOT_INITIALIZE_DRIVER: No auth provider specified
Driver created without authService or missing credentials.
fixSet authService using getCredentialsFromEnv() or explicit provider.
Audit
Dependencies
@yandex-cloud/nodejs-sdkrequiredPeer dependency for Yandex.Cloud authentication and API usage