-
Notifications
You must be signed in to change notification settings - Fork 168
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 utilitypending-releaseThis item has been merged and will be released soonThis item has been merged and will be released soon
Milestone
Description
Use case
When customers create event handlers, they should have access to the raw Lambda event and the Lambda context. We should also expose a fetch Request object for customers who wish to use familiar web standards in their handlers. This is need for both route handlers and error handlers.
Solution/User Experience
Handlers will take an options object with theese objects. The types will look something like this:
type RequestOptions = {
request: Request;
event: APIGatewayProxyEvent;
context: Context;
};
type ErrorResolveOptions = RequestOptions & ResolveOptions;
type ErrorHandler<T extends Error = Error> = (
error: T,
options?: RequestOptions
) => Promise<ErrorResponse>;
type RouteHandler<
TParams = Record<string, unknown>,
TReturn = Response | JSONObject,
> = (args: TParams, options?: RequestOptions) => Promise<TReturn>;
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 utilitypending-releaseThis item has been merged and will be released soonThis item has been merged and will be released soon
Type
Projects
Status
Coming soon