Skip to content

Commit da5825c

Browse files
committed
Add some details to the README
1 parent 41a2554 commit da5825c

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
## Lambda Handler for Probot
2+
A [Probot](https://github.com/probot/probot) extension to make it easier to run your Probot Apps in AWS Lambda.
23

3-
4-
5-
<details>
6-
<summary>TODO: Not published yet. Coming soon.</summary>
4+
## Usage
75

86
```shell
97
$ npm install @probot/serverless-lambda
108
```
119

1210
```javascript
1311
# handler.js
14-
const serverless = require('@probot/serverless-lambda');
15-
const plugin = require('./')
16-
module.exports.probot = serverless(plugin)
12+
const serverless = require('@probot/serverless-lambda')
13+
const appFn = require('./')
14+
module.exports.probot = serverless(appFn)
1715
```
1816

19-
</details>
17+
## Configuration
18+
This package moves the functionality of `probot run` into a handler suitable for usage on AWS Lambda + API Gateway. Follow the documentation on [Environment Configuration](https://probot.github.io/docs/configuration/) to setup your app's environment variables. You can add these to `.env`, but for security reasons you may want to use the [AWS CLI](https://aws.amazon.com/cli/) or [Serverless Framework](https://github.com/serverless/serverless) to set Environment Variables for the function so you don't have to include any secrets in the deployed package.
19+
20+
For the private key, since AWS environment variables cannot be multiline strings, you could [Base64 encode](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) the `.pem` file you get from the GitHub App or use [KMS](https://aws.amazon.com/kms/) to encrypt and store the key.
21+
22+
## Differences from `probot run`
23+
24+
#### Local Development
25+
Since Lambda functions do not start a normal node process, the best way we've found to test this out locally is to use [`serverless-offline`](https://github.com/dherault/serverless-offline). This plugin for the serverless framework emulates AWS Lambda and API Gateway on your local machine, allowing you to continue working from `https://localhost:3000/probot` before deploying your function to AWS.
26+
27+
#### Long running tasks
28+
Some Probot Apps that depend on long running processes or intervals will not work with this extension. This is due to the inherent architecture of serverless functions, which are designed to respond to events and stop running as quickly as possible. For longer running apps we recommend using other deployment options such as [Glitch](https://probot.github.io/docs/deployment/#glitch) or [Now](https://probot.github.io/docs/deployment/#now).
29+
30+
#### Only responds to Webhooks from GitHub
31+
This extension is designed primarily for receiving webhooks from GitHub and responding back as a GitHub App. If you are using [HTTP Routes](https://probot.github.io/docs/http/) in your app to serve additional pages, you should take a look at [`serverless-http`](https://github.com/dougmoscrop/serverless-http), which can be used with Probot's [express server](https://github.com/probot/probot/blob/master/src/server.ts) by wrapping `probot.server`.

0 commit comments

Comments
 (0)