feat(event-handler): warn when AppSync Events payload exceeds 240 KB per-event limit#5339
Merged
Merged
Conversation
svozza
approved these changes
Jun 12, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Changes
Adds an opt-in
warnOnLargePayloadoption to theAppSyncEventsResolver. When enabled, the resolver emits awarnlog whenever an individual event in the response exceeds the AWS AppSync Events per-event size limit of 240 KB (including the eventid).Events larger than this limit are silently dropped by AppSync and never delivered to subscribers, which is hard to diagnose. This gives customers a way to detect the problem before messages are lost.
Details:
warnOnLargePayloadflag onRouterOptions, disabled by default (measuring size requires serializing each event, which has a cost on large batches).aggregatemodes, since the limit applies per event regardless of how the handler is invoked.{ id, payload }item withBuffer.byteLength(JSON.stringify(...))so it reflects what AppSync sees on the wire (including theid, which the library injects in non-aggregate mode and the customer cannot otherwise measure).This implements the outcome discussed in the issue: a warning rather than a public
getSize()(which cannot see the library-injectedidin non-aggregate mode) or a post-publish hook.Tests and documentation (new "Detecting oversized events" section + snippet) are included.
Issue number: closes #4020
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.