fix(buildRequest): handle RPC code 429 in shouldRetry for batch mode#4440
Open
luanxu-dev wants to merge 2 commits intowevm:mainfrom
Open
fix(buildRequest): handle RPC code 429 in shouldRetry for batch mode#4440luanxu-dev wants to merge 2 commits intowevm:mainfrom
luanxu-dev wants to merge 2 commits intowevm:mainfrom
Conversation
Some providers (e.g. Alchemy in batch mode) return HTTP 200 with a
JSON-RPC body containing `{ code: 429 }` instead of a real HTTP 429
status. The existing shouldRetry code-path only recognised standard
RPC error codes (-1, -32005, -32603) and fell through to `return false`,
silently disabling retries.
Add an explicit `error.code === 429` check so retryCount is honoured.
Fixes: wevm#3680
Co-Authored-By: Paperclip <noreply@paperclip.ing>
…-limit)
Covers the case where a provider returns HTTP 200 with JSON body
`{ code: 429 }` (Alchemy batch mode) — shouldRetry must return true.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
@luanxu-dev is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
|
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
Fixes #3680
Root cause
shouldRetryinsrc/utils/buildRequest.tshas two branches:error.codebranch — handles standard JSON-RPC error codes (-1,-32005,-32603). Any other numericcodehitsreturn false→ no retry.HttpRequestErrorbranch — handles HTTP status codes including429.Some providers (most notably Alchemy in batch mode) respond with HTTP 200 and a JSON-RPC body of
{ code: 429 }rather than a real HTTP 429 response. Because the error arrives withcode: 429(a number), it matches branch 1 — but429is not in the recognised set, soshouldRetryreturnsfalseandretryCountis silently ignored.Fix
Add an explicit check for
error.code === 429in the code branch, before thereturn falsefallthrough:Test
Added a unit test that creates a plain
Errorwithcode: 429(no HTTP status) and assertsshouldRetryreturnstrue.Notes
HttpRequestErrorwithstatus === 429) is unchanged.