[PR #2487] [CLOSED] fix(recipient): relax search output validation to prevent 500 crash #2337

Closed
opened 2026-02-26 20:33:27 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/2487
Author: @abdulalim110
Created: 2/12/2026
Status: Closed

Base: mainHead: fix/recipient-search-crash


📝 Commits (1)

  • f0d17b7 fix(recipient): relax search output validation to prevent 500 crash

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 packages/trpc/server/recipient-router/find-recipient-suggestions.types.ts (+1 -1)

📄 Description

Description

This PR fixes a critical 500 Internal Server Error that occurs when searching for recipients with draft or non-standard email formats. It ensures that the autocomplete functionality remains stable even when encountering placeholder data in the database.

Fixes #2486

Changes Made

  • Relaxed Output Validation: Updated the ZGetRecipientSuggestionsResponseSchema in find-recipient-suggestions.types.ts by changing the email field validation from z.string().email() to z.string().
  • Reasoning: Since the application allows creating recipients with draft/placeholder emails (by design), enforcing strict email validation on the search output causes a crash when those records are retrieved.

Testing Performed

  • Production Reproduction: Verified the 500 error on app.documenso.com using the search query "new" and "test".
  • Local Validation: Confirmed that after relaxing the Zod schema, the search returns results correctly (200 OK) even for recipients with placeholder emails.
  • Regression: Ensured other recipient fields (name, id) are still mapped correctly.

Checklist

  • I have tested these changes locally and they work as expected.
  • I have added/updated tests that prove the effectiveness of these changes.
  • I have updated the documentation to reflect these changes, if applicable.
  • I have followed the project's coding style guidelines.
  • I have addressed the code review feedback from the previous submission, if applicable.

Additional Notes

The crash was a direct result of an inconsistency between the liberal input validation (allowing draft emails) and the strict output validation in the search router. This fix aligns the search API with the existing product behavior.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/2487 **Author:** [@abdulalim110](https://github.com/abdulalim110) **Created:** 2/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/recipient-search-crash` --- ### 📝 Commits (1) - [`f0d17b7`](https://github.com/documenso/documenso/commit/f0d17b71c876e410dcba937b5761227d48d2661a) fix(recipient): relax search output validation to prevent 500 crash ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/trpc/server/recipient-router/find-recipient-suggestions.types.ts` (+1 -1) </details> ### 📄 Description ## Description This PR fixes a critical **500 Internal Server Error** that occurs when searching for recipients with draft or non-standard email formats. It ensures that the autocomplete functionality remains stable even when encountering placeholder data in the database. ## Related Issue Fixes #2486 ## Changes Made * **Relaxed Output Validation**: Updated the `ZGetRecipientSuggestionsResponseSchema` in `find-recipient-suggestions.types.ts` by changing the `email` field validation from `z.string().email()` to `z.string()`. * **Reasoning**: Since the application allows creating recipients with draft/placeholder emails (by design), enforcing strict email validation on the search output causes a crash when those records are retrieved. ## Testing Performed * **Production Reproduction**: Verified the 500 error on `app.documenso.com` using the search query "new" and "test". * **Local Validation**: Confirmed that after relaxing the Zod schema, the search returns results correctly (200 OK) even for recipients with placeholder emails. * **Regression**: Ensured other recipient fields (name, id) are still mapped correctly. ## Checklist * [x] I have tested these changes locally and they work as expected. * [ ] I have added/updated tests that prove the effectiveness of these changes. * [ ] I have updated the documentation to reflect these changes, if applicable. * [x] I have followed the project's coding style guidelines. * [ ] I have addressed the code review feedback from the previous submission, if applicable. ## Additional Notes The crash was a direct result of an inconsistency between the liberal input validation (allowing draft emails) and the strict output validation in the search router. This fix aligns the search API with the existing product behavior. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:33:27 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#2337
No description provided.