Registry /
database / knex-aurora-data-api-mysql
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.
default
✓ const knex = require('knex')({ client: require('knex-aurora-data-api-mysql'), connection: {...} })
✗ import knex from 'knex-aurora-data-api-mysql'
Module is not ESM. Use require() or dynamic import(). The module is a Knex client, not a standalone query builder.
knex
✓ const knex = require('knex')({ client: 'knex-aurora-data-api-mysql', connection: {...} })
✗ const knex = require('knex')({ client: require('knex-aurora-data-api-mysql'), connection: {...} }); knex.client = ...
Pass client as string to let knex resolve, or pass the required module directly. Do not reassign client after init.
Knex
✓ const Knex = require('knex'); const knex = Knex({ client: require('knex-aurora-data-api-mysql'), connection: {...} })
✗ const { Knex } = require('knex-aurora-data-api-mysql')
Knex is imported from 'knex', not from this package. This package exports a client object.
Initializes Knex with Aurora Data API MySQL driver and runs a simple SELECT query.
const knex = require('knex')({
client: require('knex-aurora-data-api-mysql'),
connection: {
database: 'mydb',
resourceArn: 'arn:aws:rds:us-west-2:123456789012:cluster:mydbcluster',
secretArn: 'arn:aws:secretsmanager:us-west-2:123456789012:secret:mysecret',
sdkConfig: {
region: 'us-west-2',
accessKeyId: process.env.AWS_ACCESS_KEY_ID ?? '',
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY ?? ''
}
}
});
async function main() {
const result = await knex('users').where('id', 1).first();
console.log(result);
await knex.destroy();
}
main().catch(console.error);
Errors
Common errors & fixes
Error: knex: Unknown client 'knex-aurora-data-api-mysql'
Using client as string without the module being installed or incorrectly passed as require('knex-aurora-data-api-mysql')
fixUse client: require('knex-aurora-data-api-mysql') or ensure the module is installed and importable. Cannot find module 'knex-aurora-data-api-mysql'
Package not installed or not in node_modules
fixRun npm install knex-aurora-data-api-mysql
TypeError: Cannot read properties of undefined (reading 'transaction')
Attempting to create nested transaction (trx.transaction()) which is not supported
fixRemove nested transaction call. Use a single transaction scope.
CredentialsError: Missing credentials in config
AWS credentials not provided correctly; sdkConfig missing or empty
fixProvide sdkConfig with region and credentials, or set AWS environment variables.
Audit
Dependencies
knexrequiredpeer dependency - driver requires knex >= 2.4.0