Skip to content

About

Probot & AWS Lamda example using Serverless

Resources

Code of conduct

Stars

15 stars

Watchers

0 watching

Forks

Repository files navigation

Probot & AWS Lambda example

This repository is an example of how to deploy the "Hello, World" of probot apps to AWS Lambda using serverless.

Local setup

Use Node.js 26 LTS. The test dependency Nock 15 requires Node.js >=22.20.0.

Install dependencies

npm install

Start the server

npm start

Follow the instructions to register a new GitHub app.

Develop in a container

With Docker running and the VS Code Dev Containers extension installed, open this repository and choose Dev Containers: Reopen in Container. The dev container uses Node.js 26 and runs npm ci. Dependencies are stored in a separate Docker volume, so they do not replace any host node_modules.

Run npm test for a credential-free check, or run npm start and open the forwarded Probot port (3000 by default). If you already have a local .env, it is available in the mounted workspace and is not included in the container image.

Deployment

In order to deploy the app from you local environment, follow the Serverless Deploying to AWS documentation.

If you use this example as a template, make sure to update serverless.yml and set new values for

  • service
  • app
  • org

Make sure to create the following parameters on https://app.serverless.com:

  • APP_ID
  • PRIVATE_KEY
  • WEBHOOK_SECRET

For continuous deployment via GitHub action, copy this repository's deploy workflow and create the following secrets:

  1. SERVERLESS_ACCESS_KEY - You can create a Serverless access key at https://app.serverless.com/<your org>/settings/accessKeys
  2. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY - you will likely find your AWS credentials in ~/.aws/credentials

Tests

npm test

The unit tests use Nock 15 to intercept GitHub API requests, including native fetch requests. No real GitHub credentials are required.

Debug via unit tests

  1. Intall nyc and mocha: npm install -g nyc mocha
  2. From the VSCode RUN AND DEBUG menu select Mocha and click the green arrow to start debugging.

Debug by launching probot locally and sending it a payload

  1. Point your GitHub app to your local using something like smee.io
  2. Copy .env-sample to .env and populate with values specific for your GitHub app. For the PRIVATE_KEY replace newlines with \\n to make the string value a single line.
  3. From the VSCode RUN AND DEBUG menu select Launch Probot and click the green arrow to start debugging.

License

ISC

About

Probot & AWS Lamda example using Serverless

Resources

Code of conduct

Stars

15 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages