Repository navigation
Description
Summary
Under alchemy dev, an AWS.RDS.Aurora with migrations and the default transport cannot migrate against Floci, for two reasons on Alchemy's side.
- Alchemy picks the transport from the cluster's observed
HttpEndpointEnabled, not fromdataApi. Floci never reports that field, so Alchemy switches todirectwithout a word. The"data-api"default is documented, but it does not hold here. The direct connection then goes to127.0.0.1:5432, where Floci is not listening. - With the Data API transport, the migration executor always sends
formatRecordsAs: "JSON". Floci rejects that with a 400, so the first query fails before any DDL runs.
Floci's Data API itself works without the flag. On 2.1.0-alchemy.3, statements, a transaction and DDL all succeeded against a cluster that does not report HttpEndpointEnabled, so only these two checks stand in the way. RDSData.toRows already builds rows from records and columnMetadata, and that request shape is valid on AWS too.
What happened
Our app runs Aurora PostgreSQL in deployed stages and a Postgres container under alchemy dev. To drop that container, we deployed the app's Aurora props against Floci under alchemy dev semantics (Test.make({ dev: true })). Those props are: aurora-postgresql 18.6, Serverless v2 0–1 ACU, storageEncrypted with kmsKeyId, secret: { resource }, a db.serverless writer, and drizzle-kit migrations.
With the default transport (no migrationsTransport), the writer failed:
[Aurora/Writer] fail (local) — MigrationError: Failed to connect to <cluster>.cluster-<hash>.us-east-1.rds.localhost.floci.io:5432: The server does not support SSL connections (10.4s)
The server that answered is the app's own dev Postgres container on 127.0.0.1:5432, not Floci. Nothing in the log says the migrations had switched to a direct connection. A server with TLS and matching credentials would have received the migration DDL.
With migrationsTransport: "data-api":
[Aurora/Writer] fail (local) — MigrationError: DB cluster '<cluster>' does not have the Data API enabled (set enableHttpEndpoint: true) (73ms)
Aurora had created the cluster with enableHttpEndpoint: true.
With HttpEndpointEnabled faked in DescribeDBClusters by an in-process fetch shim, the Data API transport ran and failed on its first query:
[Aurora/Writer] fail (local) — MigrationError: Data API query failed: formattedRecords is not supported by this local RDS Data API implementation. (10.2s)
A second shim then answered formatRecordsAs: "JSON" by sending includeResultMetadata: true instead and building formattedRecords from the reply. With both shims, the unchanged props deployed in one pass: Done: 22 succeeded (14.7s). Migrations were applied over the Data API: 25 tables, pg_trgm, and both rows in __alchemy_migrations. A redeploy was a no-op, and destroy was clean. Those shim runs were on beta.84.
On beta.85 with the same image, raw API calls still show both refusals: EnableHttpEndpoint answers UnsupportedOperation, and formatRecordsAs: "JSON" answers 400 BadRequestException.
Cause
Links are to main at 2e423dd.
- Transport choice.
describeTargetsetsdataApiArnonly when the described cluster hasHttpEndpointEnabled(Migrations.ts#L79). Without amigrationsTransport, the transport becomestarget.dataApiArn ? "data-api" : "direct"(Migrations.ts#L278), and nothing logs which one was chosen.- Aurora documents the default as
"data-api"whendataApiis enabled (Aurora.ts#L210), creates the cluster withenableHttpEndpoint: props.dataApi ?? true(Aurora.ts#L510), and passesprops.migrationsTransportthrough unchanged (Aurora.ts#L572).
- Aurora documents the default as
- Data API executor.
querysendsformatRecordsAs: "JSON"and parsesresult.formattedRecords(Migrations.ts#L135-L142). - The pieces for a fix exist.
RDSData.toRowsmaps anincludeResultMetadata: trueresponse to rows (Marshall.ts#L81). - The Floci side is not coming with a pin bump. feat(rds): EnableHttpEndpoint, DisableHttpEndpoint and HttpEndpointEnabled floci-io/floci#5736 adds
EnableHttpEndpointandHttpEndpointEnabledupstream, but chore: merge upstream floci-io/floci main floci#21 keeps the fork's ownrdsandrdsdata. Upstream Floci also rejectsformatRecordsAs.
Suggested fix
- Executor: drop
formatRecordsAs, sendincludeResultMetadata: true, and map results withtoRows. It is one request shape on both AWS and Floci. We ran a copy of the executor changed this way against Floci, and it applied the same migrations. - Transport: make the documented default hold, so a cluster with
dataApienabled never falls back to connecting from the deploying machine to wherever the endpoint resolves. At a minimum, log the chosen transport and the reason when it differs from the documented default. - Test: cover the Aurora migrations path in the Floci lane.
Fix 1 alone does not unblock Floci, because the default stays direct while Floci omits HttpEndpointEnabled. Fixing only the Floci side moves the failure onto formatRecordsAs.
Workaround
None that we verified. Pinning migrationsTransport: "direct" needs a host route to the endpoint, and the managed alchemy-floci container does not publish 5432. An AWS.RDS.MigrationRunner Lambda inside Floci might avoid both problems, but we have not tried it. We keep a Postgres container for alchemy dev.
Out of scope
Replacing that container takes more than migrations. Hosts have no route to the emulated cluster, and its data does not survive a Floci restart (see #2724 and #2822).
Seen on @alchemy.run/aws 2.0.0-beta.84 and 2.0.0-beta.85, floci image ghcr.io/alchemy-run/floci:2.1.0-alchemy.3, Linux x86_64.
Activity
mmhand123 commentedon Nov 6, 2026
Not sure if it warrants another issue, but ran into a similar problem when just trying to connect to a floci RDS db. Worked around it for now by patching the floci package to publish port
5432. Wondering if I'm doing something wrong though in terms of using RDS via floci locally? Or is the plan to update floci to listen on that port?