-
Notifications
You must be signed in to change notification settings - Fork 173
Open
Labels
event-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 utilityresearchingThis item is currently under consideration and we'll update once we have more infoThis item is currently under consideration and we'll update once we have more info
Description
Use case
For Lambda function URLs it is possible to stream response payloads back to the client. While Event Handler does not currently support Lambda function URLs, we will in the future.
We need to investigate how this mode of response impacts the API we plan to launch at GA.
Solution/User Experience
We want an experience with as little friction as possible but there are a lot of unknowns here so this is by no means the definitive DX:
import { Router } from '@aws-lambda-powertools/event-handler/experimental-rest';
import type { Context } from 'aws-lambda';
const app = new Router({streaming: true});
app.get('/stream', async () => {
const myStream = createWriteStream()
myStream.write("Hello ");
myStream.write("world ");
myStream.write("from ");
myStream.write("Lambda!");
myStream.end();
return myStream;
});
export const handler = async (event: unknown, context: Context) => {
return app.resolve(event, context);
};
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
event-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 utilityresearchingThis item is currently under consideration and we'll update once we have more infoThis item is currently under consideration and we'll update once we have more info
Type
Projects
Status
Working on it