Skip to content

Commit

Permalink
docs(README): smoke test / Probot v11 migration key points / common e…
Browse files Browse the repository at this point in the history
…rrors (#63)
  • Loading branch information
axel3rd authored Feb 23, 2021
1 parent d126582 commit 0d7f338
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules/
.settings/
.project
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,45 @@ functions:
Make sure to configure your GitHub App registration's webhook URL to `<your lambda's URL>/api/github/webhooks`.

## Test deployment

For testing your Probot deployment without end to end (GitHub) integration, you can use this shell snippet:

```shell
$ LAMBDA_URL=https://x.execute-api.y.amazonaws.com/stage-or-basePath/api/github/webhooks
$ SECRET=the_webhook_secret
$ TMP_DATA_FILE=/tmp/smoke.data
$ echo -n "{\"action\":\"test\"}" > $TMP_DATA_FILE
$ SIGN=$(openssl dgst -sha1 -hmac $SECRET $TMP_DATA_FILE | cut -d" " -f2)
$ curl --request POST --header "X-Hub-Signature: sha1=$SIGN" --header "X-Github-Event: test" --header "X-GitHub-Delivery: fake" --data-binary "@$TMP_DATA_FILE" $LAMBDA_URL
{"ok":true} <-- Concent for Probot v10: {"message":"Received test.test"}
```

## Examples

- [example-aws-lambda-serverless](https://github.com/probot/example-aws-lambda-serverless/#readme) - Official example application that is continuously deployed to AWS Lambda

Add yours!

## Common errors

| Http Code | Message | Description |
| --------- | ---------------------------- | -------------------------------------------------------------------------------------------------- |
| 403 | Missing Authentication Token | Bad endpoint (this one is not binded on Lambda) |
| 500 | Internal server error | Incorrect headers value (`X-GitHub-Delivery`, `X-GitHub-Event`, `X-Hub-Signature`) or Probot error |

## Probot v11 migration key points

For Probot v11 support, this adapter introduces significant changes. Here the key points to update (in addition of [Probot v11 breaking changes](https://github.com/probot/probot/releases/tag/v11.0.0)):

| Key point / Probot | <= v10 | >= v11 |
| -------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------- |
| NPM package name | `@probot/serverless-lambda` | `@probot/adapter-aws-lambda-serverless` |
| _handler.js_ content | See [Usage v1.x](https://github.com/probot/adapter-aws-lambda-serverless/tree/v1.0.2#usage) | See [Usage](#usage) |
| AWS Lambda Runtime | `handler.probot` | `handler.webhooks` |
| AWS Lambda Handler | Node.js 12.x _(preferred)_ | Node.js 12.x _(required)_ |

## LICENSE

[ISC](LICENSE)

0 comments on commit 0d7f338

Please sign in to comment.