feat(mysql-aurora-serverless-driver): Migrate from aws-sdk v2 to @aws-sdk/client-rds-data - #11904
Conversation
…-sdk/client-rds-data `aws-sdk` v2 reached end-of-support on 2025-09-08, so GHSA-rvhx-wmgm-m6q9 will never get a patched release. The driver never used it at runtime — it talks to Aurora through `data-api-client` — so the only real work was the type import and the test's global SDK config. * `aws-sdk ^2.787.0` -> `@aws-sdk/client-rds-data ^3.1048.0` * `data-api-client ^1.1.0` -> `^2.4.1`, which takes `@aws-sdk/client-rds-data` as an optional peer instead of bundling the v2 SDK * `driver/index.d.ts`: `ClientConfiguration` from `aws-sdk/clients/rdsdataservice` -> `RDSDataClientConfig` from `@aws-sdk/client-rds-data` * the integration test drops the `AWS.config.*` globals and passes `region` / `credentials` / `endpoint` through the driver's `options`, which is now an `RDSDataClientConfig` `driver/AuroraServerlessMySqlDriver.js` needs no change. `@types/data-api-client` floats 1.2.3 -> 1.2.11, which swapped its `aws-sdk` dependency for `@types/aws-sdk2-types`, so `aws-sdk` leaves the lockfile entirely. Closes 2 Dependabot alerts (GHSA-rvhx-wmgm-m6q9, low) — one on the root lockfile and one on the driver's package.json. Verified with the real local-data-api + MySQL 5.6.50 compose stack: `yarn workspace @cubejs-backend/mysql-aurora-serverless-driver integration` passes 3/3 (needs `DOCKER_DEFAULT_PLATFORM=linux/amd64` on Apple Silicon, since `mysql:5.6.50` publishes no arm64 image). Plus `unit` (2/2), `yarn tsc` and a no-op `yarn install --frozen-lockfile`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Claude finished @ovr's task in 3m 26s —— View job Review complete — approve with nits: 0 high, 1 medium, 2 low (3 inline comments)Full review
VerdictThe migration itself is right: the driver never touches the SDK directly (only Findings
No security or performance concerns in the changed code; no comment-hygiene findings (the diff removes a stale commented-out Not verified
Review threadsThe listing returned 0 of my own threads (empty first page, |
`@aws-sdk/client-rds-data@^3.1048.0` resolved to 3.1130.0, whose transitive `@aws-sdk/*` / `@smithy/*` ranges sit above the ones the S3, Athena, Redshift and Snowflake drivers already had in the lockfile. yarn kept both sides, so the migration went from 3 multi-version AWS packages to 23. Merged the redundant spec keys onto the higher entry wherever the lower entry lost all of its keys — never deleting an entry and letting yarn re-resolve it, which can add a third version instead of removing the second. 19 entries collapsed directly; `@aws-sdk/token-providers@3.1038.0` then fell out as an orphan on the non-frozen prune pass. | | before | after | | --- | --- | --- | | lock entries | 2858 | 2838 | | multi-version AWS packages | 23 | 3 | The 3 that remain are pre-existing on master and not collapsible — `@smithy/is-array-buffer`, `@smithy/util-buffer-from` and `@smithy/util-utf8` each keep a 2.x alongside a 4.x. Proven with a name -> version-set diff of the lockfile: 0 new packages, 0 added versions, 20 removed versions. Plus `yarn install --frozen-lockfile` (no drift), a forced `yarn tsc` rebuild of all 5 `@aws-sdk/*` consumers, and the aurora driver's `unit` suite (2/2). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| options: { | ||
| sslEnabled: false, | ||
| region: 'us-east-1', | ||
| credentials: { accessKeyId: 'awstest', secretAccessKey: 'awstest' }, |
There was a problem hiding this comment.
This hunk is the evidence that the swap is breaking for users, not type-only. options is passed straight through to the client in driver/AuroraServerlessMySqlDriver.js:65, so an existing config like
{ options: { accessKeyId: '…', secretAccessKey: '…', sslEnabled: false, maxRetries: 5 } }used to authenticate under RDSDataService; under RDSDataClient those keys are not part of RDSDataClientConfig and are silently dropped — credentials fall back to the default provider chain and the query fails with a credentials/auth error at runtime rather than a config error at startup. httpOptions/maxRetries likewise become no-ops (requestHandler/maxAttempts now).
The test had to be rewritten for exactly this reason, so the same rewrite is required of every user who sets options. Worth a BREAKING CHANGE: footer on the commit (the PR is currently a plain feat:) plus a one-line migration note — v2 accessKeyId/secretAccessKey → credentials: { … }, sslEnabled dropped, maxRetries → maxAttempts. The driver is community-supported with no docs page, so the changelog entry is the only place a user will see it.
There was a problem hiding this comment.
@claude I am ok with such minor breaking change, I hope it doesn't affect anyone.
There was a problem hiding this comment.
Claude finished @ovr's task in 30s —— View job
Acknowledged — finding 1 closed as won't-fix
- Read trigger comment and current branch state
- Re-check the two remaining nits against
HEAD
Your call on the breaking change, and the blast radius is genuinely small: the only affected users are ones who set options.accessKeyId/secretAccessKey/sslEnabled/httpOptions/maxRetries on this driver specifically. Anyone relying on the default provider chain (IAM role, env vars, ~/.aws/credentials) is unaffected, since RDSDataClient picks those up the same way v2 did. Treating it as a plain feat: is fine with me — dropping it here so the reasoning is on the record.
The other two findings are independent of the breaking-change question and still stand on HEAD:
| # | Where | Nit |
|---|---|---|
| 2 | package.json:31 |
@types/data-api-client still ^1.2.1 against runtime 2.4.1; keeps @types/aws-sdk2-types (v2 typings) in the lockfile |
| 3 | package.json:23 |
^3.1048.0 floor forks a second AWS SDK v3 core tree instead of deduping with the athena/redshift/s3 drivers |
Both are cosmetic for correctness — the driver is plain JS, so #2 types nothing at runtime, and #3 only costs lockfile lines and image size. Happy to push either or both if you want them in this PR:
Otherwise this LGTM as-is — no code changes pushed in this run.
• branch cherry-pick-135a6d3-as-feat
There was a problem hiding this comment.
The break is a bit wider than sslEnabled. AWS SDK v2's ClientConfiguration also accepted credentials and transport settings at the top level — accessKeyId, secretAccessKey, sessionToken, maxRetries, httpOptions — and options is passed straight through to new RDSDataClient(...) (driver/AuroraServerlessMySqlDriver.js:64). v3 ignores unknown constructor keys, so a JS cube.js doing
options: { accessKeyId: '...', secretAccessKey: '...', region: 'us-east-1' }no longer errors on config — it silently falls back to the default credential chain and fails later with CredentialsProviderError: Could not load credentials from any providers, which does not point at the config key that moved. TS users get a compile error from the RDSDataClientConfig swap; JS users get nothing.
Two ways to keep it painless, either is fine:
- a changelog/release note listing the moved keys (
accessKeyId/secretAccessKey/sessionToken→credentials,maxRetries→maxAttempts,sslEnabled→ drop and use anhttpsendpoint); - or map the v2 shape in the constructor when
options.accessKeyIdis present, so existing configs keep working.
No docs page covers this driver's options, so the note is the only place a user would find out.
Reviewing PR #11904
|
…lient
`@types/data-api-client` stops at 1.2.11 — typings for `data-api-client` v1, and
its own dependency is what kept `@types/aws-sdk2-types` (the v2 SDK typings) in
the lockfile. Its `options` therefore described the v2 `RDSDataService` client
config, the opposite of what `driver/index.d.ts` now declares.
`data-api-client@2.4.1` ships its own `dist/index.d.ts`, whose
`DataAPIClientConfig.options` is `RDSDataClientConfig` from
`@aws-sdk/client-rds-data` — so the DefinitelyTyped stub is not just stale, it is
redundant. Removed it.
Verified the bundled types accept exactly the shape `index.d.ts` promises
consumers, by type-checking
```ts
import type { RDSDataClientConfig } from '@aws-sdk/client-rds-data';
import dataApi = require('data-api-client');
const cfg: RDSDataClientConfig = { region: 'us-east-1' };
const client = dataApi({ secretArn: 's', resourceArn: 'r', database: 'd', options: cfg });
export const q = client.query('select 1');
```
under `--strict --module node16` — clean.
The lockfile delta is a pure prune: 0 new packages, 0 added versions, 0 removed
versions, and `@types/aws-sdk2-types` + `@types/data-api-client` gone. So now
`aws-sdk` v2 really has left the lockfile, types included. Plus `yarn tsc`,
`yarn lint:npm` and the driver's `unit` suite (2/2).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Claude finished @ovr's task in 3m 19s —— View job Review — looks good; 0 new inline comments (1 pre-existing thread still open, answered in place)Full review
VerdictThe migration is sound. The driver never touches Checks that came back clean:
The one live concern
Review threads3 of my own threads were returned by the listing; 2 resolved, 1 left open and re-affirmed.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11904 +/- ##
=======================================
Coverage 60.67% 60.67%
=======================================
Files 240 240
Lines 19297 19297
Branches 3914 3914
=======================================
Hits 11709 11709
Misses 7040 7040
Partials 548 548
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|

aws-sdkv2 reached end-of-support on 2025-09-08, so GHSA-rvhx-wmgm-m6q9 will never get a patched release — this swaps the driver over to@aws-sdk/client-rds-data ^3.1048.0and bumpsdata-api-clientto^2.4.1, which takes the v3 client as an optional peer instead of bundling the v2 SDK. The driver never usedaws-sdkat runtime (it talks to Aurora throughdata-api-client), so the only code changes are the type import indriver/index.d.ts(ClientConfiguration->RDSDataClientConfig) and the integration test, which now passesregion/credentials/endpointthrough the driver'soptionsinstead of settingAWS.config.*globals.@types/data-api-clientfloats 1.2.3 -> 1.2.11, which swapped itsaws-sdkdependency for@types/aws-sdk2-types, soaws-sdkleaves the lockfile entirely and 2 Dependabot alerts close.Verified against the real local-data-api + MySQL 5.6.50 compose stack: the driver's
integrationsuite passes 3/3 andunit2/2, plusyarn tscand a no-opyarn install --frozen-lockfile.Check List
🤖 Generated with Claude Code