The Data API Client is a lightweight wrapper designed to simplify interactions with the Amazon Aurora Serverless Data API. It abstracts away the complexity of field values by automatically annotating native JavaScript types for input parameters and converting annotated response data back to native JavaScript types. Key features include streamlined transaction management, built-in automatic retry logic specifically optimized for Aurora Serverless scale-to-zero clusters, and compatibility layers for `pg` (node-postgres) and `mysql2/promise` drivers, enabling seamless integration with popular ORMs like Drizzle ORM and Kysely. The current stable version is 2.1.4, with active development marked by frequent minor releases addressing bug fixes, performance improvements, and new features. Version 2.0 introduced a significant migration to AWS SDK v3, full TypeScript support, and enhanced PostgreSQL data type handling, further differentiating it by offering a DocumentClient-like experience for Aurora.
npm install data-api-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `data-api-client` with necessary AWS ARN configurations, perform basic CRUD operations (insert, select, update), and showcase automatic JSONB type casting for PostgreSQL. It also illustrates how to use named parameters and configures the built-in automatic retry logic for Aurora Serverless.
Update your project's `@aws-sdk/client-rds-data` dependency to `^3.0.0` or higher. Ensure your build system supports ESM for optimal tree-shaking and compatibility.
Upgrade `data-api-client` to version 2.1.3 or higher. This version replaces the external `pg-escape` with an internal implementation, eliminating the problematic file dependencies.
Upgrade `data-api-client` to version 2.1.4 or higher. This version includes a fix that executes each parameter set individually via `ExecuteStatementCommand` when a `RETURNING` clause is detected in a batch query, avoiding the error.
Upgrade `data-api-client` to version 2.1.4 or higher. This version includes a fix for `JSONB typeName` parsing, ensuring automatic JSON parsing is consistently applied.
Upgrade `data-api-client` to version 2.1.3 or newer. This version internally implements the necessary functionality, removing the problematic external dependency.
For CommonJS, use `const DataAPIClient = require('data-api-client').default;`. For modern projects, prefer ESM `import DataAPIClient from 'data-api-client';` and ensure your environment supports ESM.Upgrade `data-api-client` to version 2.1.4 or newer. This version detects such scenarios and executes statements individually to ensure correct `RETURNING` behavior.