Repository navigation
fix(cli): log the real cause of store failures instead of [object ErrorEvent] - #692
Merged
Merged
Conversation
…orEvent] A Postgres connection the @neondatabase/serverless WebSocket driver could not open reached the runtime log as "B4.run runtime failure — [object ErrorEvent]": the driver rejects with a DOM ErrorEvent, not an Error, and String(event) reads none of the properties (message, error, code) that name the refused host. - new edge-safe runtime-error-report.ts: serializeError follows cause/error chains off anything thrown (Error, ErrorEvent-like, plain object, primitive) with cycle and depth guards; formatErrorChain renders one line per link with each link's code; errorStackOf finds the wrapped Error's stack; describeConnectionTarget keeps scheme/host/port/database and drops the user, password and query string, never echoing an unparseable string - the runtime catch-all logs and dedupes on the rendered chain - the generated stores.mjs reports a store initialisation failure once per sanitised target with the store kind, and the pool 'error' warning uses the same renderer - the helpers are exported from @b4run/cli/fetch and listed in the API docs Closes #689 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
temporarily deployed
to
vercel-preview
September 17, 2026 05:28 — with
GitHub Actions
Inactive
blove
enabled auto-merge (squash)
September 17, 2026 15:08
The @b4run/cli/fetch export table gained the error-report helpers, so the /docs/api/cli record digest moved and the freshness check exited 1. Co-Authored-By: Claude Fable 5.1 <[email protected]>
blove
temporarily deployed
to
vercel-preview
September 17, 2026 15:10 — with
GitHub Actions
Inactive
This was referenced Sep 17, 2026
blove
added a commit
that referenced
this pull request
Sep 17, 2026
…(error) Rebased onto #692, which landed the edge-safe error-chain serializer. The readiness probe's own reporting had the exact bug that fixed: the Postgres drivers reject a failed connect with a DOM ErrorEvent, so `String(error)` rendered "[object ErrorEvent]" — the one failure /readyz exists to name would have arrived unnamed. - describeReadinessFailure renders through formatErrorChain, so the root cause and its driver code reach the check body - redaction now runs over the whole rendered chain, which matters because the chain is built from driver messages that quote the connection string, and unlike the catch-all's stderr log this one is served in a response body - docs say plainly that /readyz bodies carry real causes (hosts, ports, database names, driver codes) and so must sit behind the outer boundary Co-Authored-By: Claude Opus 5 <[email protected]>
blove
added a commit
that referenced
this pull request
Sep 17, 2026
…(error) Rebased onto #692, which landed the edge-safe error-chain serializer. The readiness probe's own reporting had the exact bug that fixed: the Postgres drivers reject a failed connect with a DOM ErrorEvent, so `String(error)` rendered "[object ErrorEvent]" — the one failure /readyz exists to name would have arrived unnamed. - describeReadinessFailure renders through formatErrorChain, so the root cause and its driver code reach the check body - redaction now runs over the whole rendered chain, which matters because the chain is built from driver messages that quote the connection string, and unlike the catch-all's stderr log this one is served in a response body - docs say plainly that /readyz bodies carry real causes (hosts, ports, database names, driver codes) and so must sit behind the outer boundary Co-Authored-By: Claude Opus 5 <[email protected]>
blove
added a commit
that referenced
this pull request
Sep 17, 2026
…#694) * fix(cli): make /healthz pure liveness and add /readyz dependency readiness On the vercel (and hono) target the per-request store factory ran for every request, health checks included, so a deployment with DATABASE_URL unset or its database unreachable answered /healthz with a 500 and looked completely down instead of "up, not ready". - GET /healthz no longer calls requestStores; it answers 200 {status:"ready"} whenever the process serves HTTP (body kept for harness compatibility). - New GET /readyz builds the request's stores and probes threads, checkpointer and permissions with a real query (running lazy migrations on the way). 200 {status:"ready",checks} or 503 {status:"not_ready",checks}; a throwing factory is reported as `requestStores`, an omitted store carries B4_E5301, connection-string credentials are redacted, and each cause is logged once. - Route matching now happens before store construction so the two probes can decide what to do with the factory; every other route is unchanged. - Tests that relied on /healthz building stores now use /readyz; the thread-access coverage exempt list and route count include /readyz. - Docs: production topology, middleware, embedding, kubernetes, docker blueprint, chart README/values and llms.txt describe both probes. Fixes #688 Co-Authored-By: Claude Fable 5.1 <[email protected]> * chore(web): regenerate SEO lastmod manifest for the probe docs Co-Authored-By: Claude Fable 5.1 <[email protected]> * fix(cli): report /readyz failures through the error chain, not String(error) Rebased onto #692, which landed the edge-safe error-chain serializer. The readiness probe's own reporting had the exact bug that fixed: the Postgres drivers reject a failed connect with a DOM ErrorEvent, so `String(error)` rendered "[object ErrorEvent]" — the one failure /readyz exists to name would have arrived unnamed. - describeReadinessFailure renders through formatErrorChain, so the root cause and its driver code reach the check body - redaction now runs over the whole rendered chain, which matters because the chain is built from driver messages that quote the connection string, and unlike the catch-all's stderr log this one is served in a response body - docs say plainly that /readyz bodies carry real causes (hosts, ports, database names, driver codes) and so must sit behind the outer boundary Co-Authored-By: Claude Opus 5 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #689.
Problem
An unreachable Postgres behind
@neondatabase/serverlesssurfaced asB4.run runtime failure — [object ErrorEvent]and a generic 500. The driver rejects a failed WebSocket connect with a DOMErrorEvent, not anError, soString(error)read none of the properties (message,error,code) that name the refused host.Change
packages/cli/src/lib/dev/runtime-error-report.ts(new, edge-safe, nonode:imports)serializeErrorreads message, code and the nested chain (causefirst, the DOMerrorproperty second) off anything thrown, with cycle and depth guards.formatErrorChainrenders one line per link, each with its code.errorStackOfreturns the wrappedError's stack when the thrown object has none.describeConnectionTargetkeeps scheme, host, port and database and drops the user, password and query string. A string the URL parser rejects is never echoed.runtime-fetch-core.ts) logs and dedupes on the rendered chain, so distinct driver failures no longer collapse into one[object ErrorEvent]line.stores.mjsreports a store initialisation failure once per sanitised target with the store kind (postgres store initialisation failed against postgres://host:5432/db — …), and the pool'error'warning uses the same renderer.@b4run/cli/fetchand listed indocs/api/cli.Tests
test/runtime-error-report.test.ts: ErrorEvent-like object,causechains with codes, numeric codes, circular and runaway chains, primitives, stack lookup, and credential redaction (userinfo,?password=, unparseable libpq strings).test/edge-runtime-diagnostics.test.ts: an ErrorEvent thrown fromrequestStoreslogs the host and code, prints the wrapped stack, keeps the body opaque, and logs once.test/hono-target.test.ts: the emittedstores.mjscarries the initialisation report and noString(error).Verification
pnpm --filter @b4run/cli lintandtypecheckclean.runtime-error-report,edge-runtime-diagnostics,hono-target,vercel-target,fetch-entry-purity,server-errors,request-stores,runtime-fetch-handler).vercel-targetshowed 5 s timeouts on a box with load average over 140 and passed 95/95 when rerun.node scripts/check-docs.mjsand--analyze-detailed-api-referencespass; the docs inventory test passed 251/252 with the one failure being a spawn timeout of that same script under load.Not released.
🤖 Generated with Claude Code