Skip to content

feat(event-handler): add function to convert Lambda proxy event to web response object #4343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

svozza
Copy link
Contributor

@svozza svozza commented Aug 14, 2025

Summary

The event handler will eventually support multiple lambda event type (ALB etc). types, as such we need a common format to represent these requests. This PR adds a utility function to convert the event to the web Request types

Changes

  • Adds the proxyEventToWebRequest function to handle to converion.
  • Adds a type guard function to ensure that the event to be converted is the correct type.
  • Unit tests for both functions.

Issue number: closes #4342


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@boring-cyborg boring-cyborg bot added event-handler This item relates to the Event Handler Utility tests PRs that add or change tests labels Aug 14, 2025
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Aug 14, 2025
@svozza svozza requested a review from dreamorosi August 14, 2025 18:44
@svozza svozza self-assigned this Aug 14, 2025
@svozza svozza force-pushed the event-handler/response-handling-arch branch from d202c83 to 7ad4112 Compare August 14, 2025 18:57
@svozza svozza force-pushed the event-handler/response-handling-arch branch from 7ad4112 to 7eb3a90 Compare August 14, 2025 18:58
Copy link

@svozza svozza changed the title add function to convert Lambda proxy event to web response object feat(event-handler): add function to convert Lambda proxy event to web response object Aug 14, 2025
@@ -0,0 +1,48 @@
import type { APIGatewayProxyEvent } from 'aws-lambda';

function createBody(body: string | null, isBase64Encoded: boolean) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally try to use arrow functions across the project, except for cases where we need the scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-handler This item relates to the Event Handler Utility size/L PRs between 100-499 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Add function to convert Lambda event to web Request object
2 participants