Fix BUILD-1144: Prevent Neynar API 20-character limit error #49
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 BUILD-1144 where Ethereum addresses (42 characters) caused 400 Bad Request errors when searching users via the Neynar API, which has a requirement that the
qparameter must be 20 characters or less.Changes
searchUsersByUsername()to check string length0x/searchroute to return proper 400 responses with descriptive messagesRoot Cause
The Neynar
/v2/farcaster/user/searchendpoint validates that theqparameter is ≤20 characters. When users attempted to search with Ethereum addresses like0x0B5f5a722Ac5E8EcEDf4da39A656fe5f1e76b34C, the API returned:{"code":"InvalidField","message":"q must be a string of length 20 or less","property":"q"}Solution
Test Plan
🤖 Generated with Claude Code