npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@probot/adapter-aws-lambda-serverless

v4.0.0

Published

An extension for running Probot in AWS Lambda

Downloads

15,919

Readme

@probot/adapter-aws-lambda-serverless

Adapter to run a Probot application function in AWS Lambda using the Serverless Framework

Build Status

Usage

npm install @probot/adapter-aws-lambda-serverless
// handler.js
const {
  createLambdaFunction,
  createProbot,
} = require("@probot/adapter-aws-lambda-serverless");
const appFn = require("./");
module.exports.lambdaFn = createLambdaFunction(appFn, {
  probot: createProbot(),
});

Configuration

You need to add environment variables to configure Probot to your Lambda function. If you use the Serverless App, you can add parameters for APP_ID, PRIVATE_KEY, WEBHOOK_SECRET, the use these parameters in serverless.yaml.

provider:
  name: aws
  runtime: nodejs12.x
  lambdaHashingVersion: 20201221
  environment:
    APP_ID: ${param:APP_ID}
    PRIVATE_KEY: ${param:PRIVATE_KEY}
    WEBHOOK_SECRET: ${param:WEBHOOK_SECRET}
    NODE_ENV: production
    LOG_LEVEL: debug

functions:
  probot:
    handler: handler.lambdaFn
    events:
      - httpApi:
          path: /api/github/webhooks
          method: post

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:

$ 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

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):

| Key point / Probot | <= v10 | >= v11 | | -------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------- | | NPM package name | @probot/serverless-lambda | @probot/adapter-aws-lambda-serverless | | handler.js content | See Usage v1.x | See Usage | | AWS Lambda Runtime | handler.probot | handler.webhooks | | AWS Lambda Handler | Node.js 12.x (preferred) | Node.js 12.x (required) |

LICENSE

ISC