Kysely Data API is a specialized library that extends the `kysely` type-safe SQL query builder to provide seamless integration with the AWS RDS Data API. This enables serverless applications, particularly those built on AWS Lambda, to interact with Amazon RDS databases (both MySQL and PostgreSQL) without requiring traditional, long-lived database connections. The current stable version is 2.0.0, indicating a mature and actively developed project, though a specific release cadence is not publicly defined. Its key differentiator lies in abstracting the complexities of the RDS Data API into a familiar `kysely` dialect, allowing developers to leverage `kysely`'s powerful type-safe query building capabilities within a serverless, event-driven architecture, simplifying database interactions and resource management.
npm install kysely-data-apiVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to initialize `Kysely` with `DataApiDialect` for AWS RDS Data API, configuring it with essential ARN values and performing a simple select query.
Consult the official migration guide (if available) or the latest README for `kysely-data-api` for specific changes to the API and configuration.
Verify that the associated IAM role/user has the necessary `rds-data:ExecuteStatement`, `rds-data:BatchExecuteStatement`, etc., permissions and access to both the database cluster resource and the Secrets Manager secret.
Ensure that the `secretArn` (pointing to a Secrets Manager secret containing database credentials) and `resourceArn` (pointing to your RDS database cluster or instance) are correctly provided in the driver configuration. These are often passed via environment variables in serverless contexts.
Always install `kysely-data-api` alongside a compatible `kysely` version as specified in its `peerDependencies`. Update both packages together after checking for compatibility notes.
Review and update the IAM policy attached to your AWS role or user, ensuring it includes `rds-data:ExecuteStatement` (and other `rds-data:*` actions as needed) on the `resourceArn` and `secretArn`.
Ensure that the `secretArn` field is correctly populated with the ARN of your AWS Secrets Manager secret containing database credentials.
Verify that the `resourceArn` is accurate and points to an RDS cluster that specifically has the Data API feature turned on in its configuration.