Repository navigation
Description
Summary
Every list/get route mounted through @metaobjectsdev/runtime-ts/hono returns HTTP 500 on a Postgres project, because the Hono adapter calls Drizzle's libsql/better-sqlite3-only .all() / .get() terminal methods. drizzle-orm/postgres-js's query builder has neither — it is thenable and must simply be awaited.
The fix already exists in this repo, in the sibling Fastify adapter, with a comment explaining precisely this. It was never ported to the Hono adapter.
Evidence
dist/drizzle-fastify/index.js:130-134 — correct, and self-documenting:
// Await the query directly rather than calling `.all()`: the
// drizzle-orm node-postgres query builder is thenable but has no `.all()`
// method (that is a libsql/better-sqlite3-only API). Awaiting works on
// both dialects and is what makes this helper genuinely Postgres-capable.
const rows = await q;dist/hono/index.js — still the old form:
:90 const rows = await q.all();
:97 const countRow = (await cq.all())[0];
:121 .get();Same in dist/hono/mount-read-only.js:103,109,140.
Symptom
TypeError: q.all is not a function
on any GET /api/<entity> or GET /api/<entity>/:id served by mountCrudRoutes / mountReadOnlyCrudRoutes / mountListRoute / mountGetRoute from @metaobjectsdev/runtime-ts/hono, against drizzle-orm/postgres-js.
POST / PATCH / DELETE are unaffected — they don't use those terminal methods.
Affected versions
Reproduced on 0.21.2. 0.21.3 was unpacked and inspected and contains the same unfixed code (not installed).
Suggested fix
Apply the Fastify adapter's already-proven change to hono/index.js and hono/mount-read-only.js:
await q.all()→await q.get()→await qand take[0](or.limit(1)then index)
Impact
This makes routesFileHono() unusable end-to-end on Postgres, which is the combination the Hono adapter most plausibly targets (Hono is commonly paired with Postgres on Node/Bun as well as with D1/SQLite on Workers). An adopter following the metaobjects-runtime-ui skill's own guidance — "mount the standard verbs with these helpers and hand-write only the custom routes" — hits it immediately on the first GET.
There appears to be no cross-adapter conformance test covering list/get against Postgres for the Hono adapter; the Fastify adapter's fix having landed without the Hono one suggests the two adapters aren't exercised by a shared dialect matrix. That may be worth more than the one-line fix.
Context
Reported from a real adopting project (Bun + Hono + drizzle-orm/postgres-js + PostgreSQL 16), which is generating its entire REST surface from metadata rather than hand-writing CRUD. We deliberately did not hand-write substitute routes or locally patch the dependency, and are reporting instead.
Related, same adopter, still open: #285 (migrate emits DROP INDEX for a unique-constraint-backed index).
Activity
fix(runtime-ts): make the Hono CRUD helpers work on Postgres (#286)
dmealing commentedon Aug 9, 2026
Fixed on
mainin0dd925fd— ships in the next release.Your diagnosis was exact, including that the fix already existed in the Fastify adapter. All six Hono call sites now use the portable form:
await qfor lists,.limit(1)+[0]for single-row reads.You were right that the signal matters more than the one-liner, so that's where most of the work went. The reason Fastify's fix landed alone is that every adapter test in the package used libsql — where
.all()/.get()exist and work. No test could have caught this for either adapter; Fastify's fix was reasoned, not gated. A per-adapter suite with a single dialect structurally cannot detect a dialect divergence.So there's now a cross-adapter dialect matrix against a real Postgres: the same read paths (list, get-by-id, 404,
withCountenvelope, filter+sort) asserted across Fastify and Hono, plus a payload-equality check between them. Adding a third adapter means adding a row, not a new file. Verified to reproduce yourq.all is not a functionon four tests with the fix reverted.One wrinkle worth recording:
runtime-ts's suite runs in thets-unitCI lane, which has no database — so a Postgres test there would have skipped forever. The matrix is wired intots-slow(the lane with the sidecar), next to the migrate-ts real-PG gate, with the same loud-skip sentinel: a lane that declares it intends Postgres and then doesn't supply it now fails instead of skipping silently.Re #285 — already fixed earlier today in
f6a4ce6f, also onmainand unreleased. Glad the rebuild-from-metadata route unblocked you; you were right that Drizzle adopters will hit it, sinceunique()produces constraints rather than bare indexes. Introspection now readspg_constraint.conindidand the emitter drops the constraint instead.Thanks for not hand-writing substitute routes or patching the package locally — keeping the failure intact is what made both of these diagnosable rather than folklore.
test(runtime-ts): run the dialect matrix against BOTH entry points
dmealing commentedon Aug 9, 2026
Fixed and released in 0.21.4 (npm
@metaobjectsdev/[email protected]).All six Hono call sites now use the portable form —
await qfor lists,.limit(1)+[0]for single-row reads — instead of Drizzle's libsql/better-sqlite3-only.all()/.get(). You had it exactly right that the Fastify adapter already carried the fix; it simply never got ported.On why this shipped broken through 0.21.2 and 0.21.3: runtime-ts's own suite runs in a lane with no database, and every adapter test there used libsql — precisely where
.all()/.get()work. The dialect matrix now runs against a real Postgres through both entry points, so an adapter cannot diverge from its sibling silently again.See
CHANGELOG.md[0.21.4].docs: propagate 0.21.5 / 7.21.5 across README, llms.txt, port docs an…
fix(ci): the only real-engine migration gate ran with no database loc…