Skip to content

fix(parser): accept documented SES receipt event variants - #5772

Merged
svozza merged 1 commit into
aws-powertools:mainfrom
vishwakt:fix/5771-parser-ses-conditional-fields
Oct 3, 2026
Merged

svozza merged 1 commit into
aws-powertools:mainfrom
vishwakt:fix/5771-parser-ses-conditional-fields

Conversation

@vishwakt

@vishwakt vishwakt commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Summary

SesSchema required fields that SES only sends conditionally, so common receipt events failed to parse, and it read the Reply-To header under a key SES does not send. This aligns the schema with the SES receiving notification contents and with a captured receipt event linked in the issue.

Changes

  • Made receipt.dmarcPolicy optional. SES sends it only when the message fails DMARC, so every email that passes or gets a GRAY verdict was rejected.
  • Changed receipt.action.invocationType to accept RequestResponse as well as Event, and made it optional. The docs list both values, and the captured event linked in the issue has no invocationType at all.
  • Made every mail.commonHeaders field optional. The docs say each one is present only if the incoming email has the matching header, so for example an email sent only to BCC recipients has no to.
  • Renamed the Reply-To field from 'reply-to' to replyTo. The docs' field table and the captured event both use replyTo, so the header was always stripped. This removes 'reply-to' from the inferred SesEvent type, but since SES never sends that key, no parsed event could have had a value there.
  • Removed dmarcPolicy from the base.json fixture and the JSDoc example, where it was paired with a DMARC pass, a combination the docs rule out. Added a Reply-To header to the fixture, so the existing round-trip test now covers replyTo and the missing dmarcPolicy.
  • Added tests for a DMARC failure that keeps dmarcPolicy, both invocation types, an action without an invocation type, and an email without any common headers. Every new and updated test fails against the schema on main.

Issue number: closes #5771


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

SesSchema required fields that SES only sends conditionally, so common emails were rejected, and it read the Reply-To header under a key SES does not use.

- dmarcPolicy is optional, since SES only sends it when the message fails DMARC.
- action.invocationType accepts RequestResponse as well as Event, and is optional, since captured events without it exist.
- Every commonHeaders field is optional, since each one is present only if the email has the matching header.
- The Reply-To header is read from replyTo, the key SES sends, instead of reply-to, which was always stripped.

The fixture no longer pairs a DMARC pass with a DMARC policy and now includes a Reply-To header.

Closes aws-powertools#5771
@svozza
svozza merged commit 13257dd into aws-powertools:main Oct 3, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M PR between 30-99 LOC

2 participants