Skip to content

Conversation

@cabljac
Copy link
Contributor

@cabljac cabljac commented Dec 2, 2025

Fixes #2550 - Email delivery failing with "Expected array, received object" Zod validation error.

The attachmentsSchema now uses z.preprocess() to normalize attachment inputs before validation:

  • Single attachment objects are automatically
    wrapped in an array
  • null values are treated as "no attachments"
  • Empty attachment objects are filtered out

Also replaced direct .parse() calls with .safeParse() for better error handling.

Test plan

  • Existing tests updated to reflect new
    lenient behavior
  • Added test for single attachment object
    normalization
  • All validation and prepare-payload tests
    pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 [firestore-send-email] Delivery fails consistently with "Expected array, received object" (SMTP/Mandrill)

1 participant