TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

now.sh extension for Probot

A Probot extension to make it easier to run your Probot Apps serverless on now.sh v2.

This extension is based on @probot/serverless-lambda and uses much of its code.


$ npm install @sanalytics/probot-serverless-now
// index.js
import { serverless } from '@sanalytics/probot-serverless-now';
import app from './app';

// the following is different from serverless-lambda, as the current working directory does not contain the package.json on now.sh v2
import { name as appName, version as appVersion } from '../package.json';

// make sure to pass appName and appVersion
export default serverless(app, appName, appVersion);
// app.js
import { Application } from 'probot';

export default (app: Application) => {
  app.on('issues.opened', async context => {
    // A new issue was opened, what should we do with it?


This package moves the functionality of probot run into a handler suitable for usage on now.sh v2. Follow the documentation on Environment Configuration to setup your app's environment variables. You can add these to .env, but for security reasons you may want to use the now CLI to set Environment Variables for the function so you don't have to include any secrets in the deployed package.

Since you might run into issues with limits related to now.sh environment variables and secrets, just use the pem keyfile (or create one using the key included in your .env file where all \n are replaced with actual new lines) together with now-cli:

now secret add private_key "$(cat key.pem | base64)"

Then set the environment variable PRIVATE_KEY either in your now.json as shown below or in your deploy command with now -e PRIVATE_KEY="@private_key@

  "env": {
    "PRIVATE_KEY": "@private_key"

To decode the private key during your app startup, use node's Buffer.from before you initalize your app:

process.env.PRIVATE_KEY = Buffer.from(process.env.PRIVATE_KEY, 'base64').toString('binary');

Differences from probot run

Local Development

Since now.sh functions do not start a normal node process, the best way we've found to test this out locally is to use zeit/micro. Having a dev script in your package.json allows you to continue working from https://localhost:3000/probot before deploying your function to now.sh. When you're developing with typescript, make sure to run npm i -D typescript ts-node micro-dev @types/node @types/micro and npm i micro probot

  "scripts": {
    "dev": "ts-node --typeCheck node_modules/.bin/micro-dev src/index.ts"

Long running tasks

Some Probot Apps that depend on long running processes or intervals might not work with this extension or result in high costs. 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.

Only responds to Webhooks from GitHub

This extension is designed primarily for receiving webhooks from GitHub and responding back as a GitHub App. If you are using HTTP Routes in your app to serve additional pages, you should take a look at serverless-http, which can be used with Probot's express server by wrapping probot.server.


npm i @sanalytics/probot-serverless-now

DownloadsWeekly Downloads






Unpacked Size

26.4 kB

Total Files


Last publish


  • passionkind