Skip to content
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

refactor(middleware): remove aws-lambda handler #333

Closed
wants to merge 2 commits into from
Closed
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
65 changes: 0 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1018,71 +1018,6 @@ All exposed paths will be prefixed with the provided prefix. Defaults to `"/api/
</tbody>
</table>

### `createAWSLambdaAPIGatewayV2Handler(app, options)`

Event handler for AWS Lambda using API Gateway V2 HTTP integration.

```js
// worker.js
import {
OAuthApp,
createAWSLambdaAPIGatewayV2Handler,
} from "@octokit/oauth-app";
const app = new OAuthApp({
clientType: "oauth-app",
clientId: "1234567890abcdef1234",
clientSecret: "1234567890abcdef1234567890abcdef12345678",
});

export const handler = createAWSLambdaAPIGatewayV2Handler(app, {
pathPrefix: "/api/github/oauth",
});

// can now receive user authorization callbacks at /api/github/oauth/callback
```

<table width="100%">
<thead align=left>
<tr>
<th width=150>
name
</th>
<th width=70>
type
</th>
<th>
description
</th>
</tr>
</thead>
<tbody align=left valign=top>
<tr>
<th>
<code>app</code>
</th>
<th>
<code>OAuthApp instance</code>
</th>
<td>
<strong>Required</strong>.
</td>
</tr>
<tr>
<th>
<code>options.pathPrefix</code>
</th>
<th>
<code>string</code>
</th>
<td>

All exposed paths will be prefixed with the provided prefix. Defaults to `"/api/github/oauth"`

</td>
</tr>
</tbody>
</table>

### Build Custom Middlewares

When above middlewares do not meet your needs, you can build your own
Expand Down
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@octokit/core": "^4.0.0",
"@octokit/oauth-authorization-url": "^5.0.0",
"@octokit/oauth-methods": "^2.0.0",
"@types/aws-lambda": "^8.10.83",
baoshan marked this conversation as resolved.
Show resolved Hide resolved
"fromentries": "^1.3.1",
"universal-user-agent": "^6.0.0"
},
Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import type {
State,
} from "./types";

// types required by external handlers (aws-lambda, etc)
// types required by external middlewares (aws-lambda, etc)
export type {
HandlerOptions,
OctokitRequest,
Expand All @@ -65,7 +65,6 @@ export { unknownRouteResponse } from "./middleware/unknown-route-response";
export { createNodeMiddleware } from "./middleware/node/index";
export { sendResponse as sendNodeResponse } from "./middleware/node/send-response";
export { createWebWorkerHandler } from "./middleware/web-worker/index";
export { createAWSLambdaAPIGatewayV2Handler } from "./middleware/aws-lambda/api-gateway-v2";
Copy link
Member

Choose a reason for hiding this comment

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

If we are removing exposed methods, should we do an intermediate version deprecating these upcoming removals?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this will be released as a major version bump.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this will be released as a major due to the breaking changes. I was just wondering if we want to do an intermediate minor version warning about the upcoming deprecations to our users.

I guess is more a question to the core maintainers.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, that is our usual process. Ideally, a breaking change removes previously deprecated APIs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, it would be great if there was a dedicated npm package that would provide the createAWSLambdaAPIGatewayV2Handler handler. We could release it as an @octokit/* package, but I'd prefer if somone else who actually uses the handler would release it, and we could link to it from the readme and the deprecation message.

Copy link
Member

Choose a reason for hiding this comment

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

I would resolve this conversation for the moment and, if a user comes by with the request we can open a Discussion.


type Constructor<T> = new (...args: any[]) => T;

Expand Down
13 changes: 0 additions & 13 deletions src/middleware/aws-lambda/api-gateway-v2-parse-request.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/middleware/aws-lambda/api-gateway-v2-send-response.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/middleware/aws-lambda/api-gateway-v2.ts

This file was deleted.

123 changes: 0 additions & 123 deletions test/aws-lambda-api-gateway-v2.test.ts

This file was deleted.