fix(icypeas): surface submit-time validationErrors as a descriptive error#5142
fix(icypeas): surface submit-time validationErrors as a descriptive error#5142TheodoreSpeaks wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview
Tests cover verify/find on Reviewed by Cursor Bugbot for commit 139f85b. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
@greptile review |
|
@BugBot review |
|
@greptile review |
1 similar comment
|
@greptile review |
|
@BugBot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 580ccde. Configure here.
… not a fake verdict
|
Reworked the approach after reproducing the live call. The earlier commits mapped a 200 |
|
@greptile review |
1 similar comment
|
@greptile review |
|
@BugBot review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 139f85b. Configure here.
Summary
Icypeas email-verification did not return an item _idonsupport@stripe.com) was misdiagnosed at first. Reproducing the live call shows Icypeas returns HTTP 200{ success: false, validationErrors: [{ message: "insufficient_credits", humanReadableMessage: "Insufficient credits to run the search", ... }] }— the hosted account is out of credits, not an invalid/role-based email.transformResponseonly handled the{ success: true, item: { _id } }shape, so any submit-timevalidationErrorsbody threw the cryptic missing-_iderror.verify_email.tsandfind_email.tsdetect a non-emptyvalidationErrorsarray and throw the human-readable reason (Icypeas ... rejected the request: Insufficient credits to run the search). A submit rejection is never a deliverability verdict, so it surfaces as a real, legible error instead of a fabricatedvalid: false/ empty result.ICYPEAS_API_KEYaccount has no credits. Top it up — code only makes the failure legible.Type of Change
Testing
support@stripe.comsubmit response to confirm the exactvalidationErrorsshape.insufficient_credits), falls back tomessage, still throws on asuccess: truebody missing_id. 16/16 pass.bun run lint:check,bun run check:api-validation:strictpass.Checklist