Skip to content

fix(tx-broadcast): log caught error shape to diagnose prod INTERNAL fallthrough#303

Merged
rz1989s merged 1 commit into
mainfrom
fix/issue-299-followup-debug-log
May 23, 2026
Merged

fix(tx-broadcast): log caught error shape to diagnose prod INTERNAL fallthrough#303
rz1989s merged 1 commit into
mainfrom
fix/issue-299-followup-debug-log

Conversation

@rz1989s
Copy link
Copy Markdown
Member

@rz1989s rz1989s commented May 23, 2026

Summary

Follow-up to #299 / #302. Prod smoke after deploy returns either:

  • 500 { code: "INTERNAL", message: "unknown error" } — my route's fallthrough, meaning err is NOT an Error instance, OR
  • Cloudflare 502 Bad gateway HTML — meaning the origin didn't respond at all

Local repro via a standalone Node script (diag2.mjs against the dist build) confirms sendAndConfirmWithRetry throws TransactionFailedOnChainError correctly:

[diag2] THREW after 2021ms
[diag2]   name: TransactionFailedOnChainError
[diag2]   constructor: TransactionFailedOnChainError
[diag2]   isError: true
[diag2]   isTransactionFailedOnChainError: true
[diag2]   signature: 3hzQfo9YL57qNPmDKmK961LFB1b4qhexavW6zKMLtyGerSkFaDFzXTQyrFTUhdPA5kToZw2sLu3c6VTJEx2rgR3t
[diag2]   err: {"InstructionError":[0,{"Custom":1}]}

Yet prod's instanceof checks evidently don't match. Adding one console.error in the catch with the shape of the caught value (constructor name, instanceof flags, message, stringified). The smoke flow can be re-run after deploy to see what err actually is, then a follow-up PR fixes the root cause.

Test plan

  • pnpm typecheck clean across root + sdk + app + agent
  • pnpm vitest run tests/routes/tx-broadcast.test.ts — 13 passed
  • Post-merge: re-run smoke and read docker logs sipher | grep "[tx/broadcast]" to capture err shape
  • Follow-up PR: actual fix based on what the log reveals

…allthrough

Follow-up to #299: prod returns 500 INTERNAL "unknown error" instead of the
new 502 TX_FAILED_ON_CHAIN envelope for confirmed-with-err txs. Local repro
via diag2 confirms sendAndConfirmWithRetry throws TransactionFailedOnChainError
correctly with all the expected properties (instanceof Error: true,
instanceof TransactionFailedOnChainError: true). Yet in prod the route's
instanceof checks evidently don't match, since the fallthrough INTERNAL
branch fires with rawMessage defaulting to 'unknown error' — meaning the
caught value isn't even an Error instance.

This commit adds a single console.error in the catch with the shape of the
caught value (constructor name, instanceof flags, message, stringified).
The smoke flow can be re-run after deploy to see what err actually is and
fix the root cause in a follow-up PR.

No behavior change for non-prod or for the existing happy path. Tests +
typecheck remain clean (1652 agent / 13 tx-broadcast / 8 sendWithRetry).
@vercel vercel Bot requested a deployment to Preview May 23, 2026 15:17 Abandoned
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sipher Ready Ready Preview, Comment May 23, 2026 3:17pm

@rz1989s rz1989s merged commit fe76641 into main May 23, 2026
8 checks passed
@rz1989s rz1989s deleted the fix/issue-299-followup-debug-log branch May 23, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant