generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedevent-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler Utilityfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utility
Description
Use case
We have added added streaming functionality back in #4476 but didn't expose it because we didn't support function URLs. With the merging of #4714 we now support this lambda integration so should make it available for use.
Solution/User Experience
We should expose a healper function that will turn a router into a stream compatible lambda handler:
export const handler = streamify(app)This will just be a wrapper around the built in lambda stream function that the lambda run time provides:
function streamify(app: Router) {
return awslambda.streamifyResponse(async (event, responseStream, context) => {
const res = await app.resolveStream(convertV2ToV1(event), context, {responseStream});
console.log(res)
})
}Not we also need to provide a fallback for the awslambda.streamifyResponse global so that our unit tests will work. All the streaming unit tests will also need to be updated to use the helper function.
Alternative solutions
Acknowledgment
- This feature request meets Powertools for AWS Lambda (TypeScript) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedevent-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler Utilityfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utility
Type
Projects
Status
Coming soon