Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions .changeset/chilled-teachers-bathe.md

This file was deleted.

59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# @as-integrations/aws-lambda

## 2.0.0

### Major Changes

- [#67](https://github.com/apollo-server-integrations/apollo-server-integration-aws-lambda/pull/67) [`5669d23`](https://github.com/apollo-server-integrations/apollo-server-integration-aws-lambda/commit/5669d237acd426fcb790ea11b1ba6632a6ea28f2) Thanks [@BlenderDude](https://github.com/BlenderDude)! -

## Why Change?

In the interest of supporting more event types and allowing user-extensibility, the event parsing has been re-architected. The goal with v2.0 is to allow customizability at each step in the event pipeline, leading to a higher level of Lambda event coverage (including 100% custom event requests).

## What changed?

The second parameter introduces a handler that controls parsing and output generation based on the event type you are consuming. We support 3 event types out-of-the-box: APIGatewayProxyV1/V2 and ALB. Additionally, there is a function for creating your own event parsers in case the pre-defined ones are not sufficient.

This update also introduces middleware, a great way to modify the request on the way in or update the result on the way out.

```typescript
startServerAndCreateLambdaHandler(
server,
handlers.createAPIGatewayProxyEventV2RequestHandler(),
{
middleware: [
async (event) => {
// event updates here
return async (result) => {
// result updates here
};
},
],
},
);
```

## Upgrade Path

The upgrade from v1.x to v2.0.0 is quite simple, just update your `startServerAndCreateLambdaHandler` with the new request handler parameter. Example:

```typescript
import {
startServerAndCreateLambdaHandler,
handlers,
} from '@as-integrations/aws-lambda';

export default startServerAndCreateLambdaHandler(
server,
handlers.createAPIGatewayProxyEventV2RequestHandler(),
);
```

The 3 event handlers provided by the package are:

- `createAPIGatewayProxyEventV2RequestHandler()`
- `createALBEventRequestHandler()`
- `createAPIGatewayProxyEventRequestHandler()`

Each of these have an optional type parameter which you can use to extend the base event. This is useful if you are using Lambda functions with custom authorizers and need additional context in your events.

Creating your own event parsers is now possible with `handlers.createRequestHandler()`. Creation of custom handlers is documented in the README.

## 1.2.1

### Patch Changes
Expand Down
1 change: 1 addition & 0 deletions cspell-dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ changesets
cimg
circleci
codesandbox
customizability
direnv
testsuite
unawaited
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@as-integrations/aws-lambda",
"description": "An Apollo Server integration for hosting on AWS Lambda",
"version": "1.2.1",
"version": "2.0.0",
"author": "Michael Watson & Daniel Abdelsamed",
"license": "MIT",
"repository": {
Expand Down