Revert streaming codable handler and provide it as an example, not an API #549
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.
Revert streaming codable handler change and propose it as an example instead of an handler API.
Motivation:
I made a mistake when submitting this PR
#532
It provides a Streaming+Codable handler that conveniently allows developers to write handlers with
Codable
events for streaming functions.This is a mistake for three reasons:
This is the only handler that assumes a Lamba Event structure as input. I added a minimal
FunctionUrlRequest
andFunctionURLResponse
to avoid importing the AWS Lambda Events library. It is the first handler to be event-specific. I don't think the runtime should introduce event specific code.The handler only works when Lambda functions are exposed through Function URLs. Streaming functions can also be invoke by API or CLI.
The handler hides
FunctionURLRequest
details (HTTP headers, query parameters, etc.) from developersDevelopers were unaware they were trading flexibility for convenience
The lack of clear documentation about these limitations led to incorrect usage patterns and frustrated developers who needed full request control or were using other invocation methods.
Modifications:
Result:
The only API provided by the library to use Streaming Lambda functions is exposing the raw
ByteBuffer
as input, there is no moreCodable
handler for Streaming functions available in the API. I kept theStreaming+Codable
code an example.After this change, developers have clear guidance on when to use each streaming approach:
This prevents misuse of the API and sets proper expectations about the handler's capabilities and limitations, leading to better developer experience and fewer integration issues.