fix(tx-broadcast): log caught error shape to diagnose prod INTERNAL fallthrough#303
Merged
Merged
Conversation
…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).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
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, OR502 Bad gatewayHTML — meaning the origin didn't respond at allLocal repro via a standalone Node script (
diag2.mjsagainst the dist build) confirmssendAndConfirmWithRetrythrowsTransactionFailedOnChainErrorcorrectly:Yet prod's
instanceofchecks evidently don't match. Adding oneconsole.errorin 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 typecheckclean across root + sdk + app + agentpnpm vitest run tests/routes/tx-broadcast.test.ts— 13 passeddocker logs sipher | grep "[tx/broadcast]"to capture err shape