In alchemy dev, an Effect Worker using SQL.Postgres({ url: hyperdrive.connectionString }) logs this on its first query:
workerd/api/sockets.c++:681: error: NOSENTRY startTls called with unsupported expectedServerHostname option
The local Hyperdrive binding hands the Worker a localhost URL with sslmode=prefer. SQL/PostgresTls.ts turns prefer into ssl: true, @effect/sql-pg upgrades the socket with a server name, and workerd's startTls does not support that option. The connection then falls back to plaintext on the in-process hop to the passthrough, so queries work, but every new connection logs an error and spends time on the failed upgrade. Together with the passthrough's own connection to the origin, the first query on a cold PlanetScale PS_DEV branch can exceed @effect/sql-pg's 5-second default connectTimeout.
Reproduce: Cloudflare.Hyperdrive.Connection with dev: role.pooledOrigin (PlanetScale), an Effect Worker querying through SQL.Postgres, and alchemy dev.
Suggested fix: when the URL points at the local dev passthrough (localhost), resolve ssl: false rather than true; the passthrough performs TLS to the real origin itself. Observed with alchemy 2.0.0-beta.80 and @effect/sql-pg 4.0.0; SQL/PostgresTls.ts is unchanged on main (ea384f0).
In
alchemy dev, an Effect Worker usingSQL.Postgres({ url: hyperdrive.connectionString })logs this on its first query:The local Hyperdrive binding hands the Worker a
localhostURL withsslmode=prefer.SQL/PostgresTls.tsturnspreferintossl: true,@effect/sql-pgupgrades the socket with a server name, and workerd'sstartTlsdoes not support that option. The connection then falls back to plaintext on the in-process hop to the passthrough, so queries work, but every new connection logs an error and spends time on the failed upgrade. Together with the passthrough's own connection to the origin, the first query on a cold PlanetScalePS_DEVbranch can exceed@effect/sql-pg's 5-second defaultconnectTimeout.Reproduce:
Cloudflare.Hyperdrive.Connectionwithdev: role.pooledOrigin(PlanetScale), an Effect Worker querying throughSQL.Postgres, andalchemy dev.Suggested fix: when the URL points at the local dev passthrough (localhost), resolve
ssl: falserather thantrue; the passthrough performs TLS to the real origin itself. Observed with alchemy 2.0.0-beta.80 and @effect/sql-pg 4.0.0;SQL/PostgresTls.tsis unchanged on main (ea384f0).