question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Milestone: serverless/function runtime

See original GitHub issue

This is just an early draft.

Once Probot v10 is released (#1274), we will focus on Making Probot work well in function/serverless environments, including

  1. AWS Lambda (see existing adapter: https://github.com/probot/serverless-lambda)
  2. Azure functions (see existing adapter: https://github.com/ethomson/probot-serverless-azurefunctions)
  3. Google Cloud Functions (see existing adapter: https://github.com/probot/serverless-gcf)
  4. GitHub Actions (See existing adapter: https://github.com/probot/actions-adapter)
  5. Clouflare Workers
  6. Architect
  7. Vercel

And popular frameworks, such as

  1. serverless
  2. next.js

Please let us know if there are other environments that you would like to use Probot in, and we will take it into account if we can.

We are in an early planning phase and welcome your input. If you would like to use Probot in any of these environments, what would your “dream API” look like? Do you know of comparable projects that do a great project of being compatible with popular serverless/function environments while still providing a good old server for traditional node server environments?

Questions

  • Compared to today’s Serverless deployment documentation. What would documentation look like for the different serverless/function environments, if we could just dream up Probot usage code?

The Plan

  1. Move the multi-application layer of Probot into a separate project, e.g. @probot/multi-app
  2. Remove all custom handling of Webhooks, only use @octokit/webhooks instead
  3. Make probot easier to decompose, by turning built-in functionality into Octokit plugins
  • logging with Bunyan
  • loading configuration from .github/[app name].yml files
  1. Move logic that requires a server into separate projects
  • GitHub App registration based on app.yml
  • Verify app settings has all events enabled that the app is subscribing to

Observations

  • GitHub Functions does not need webhook verification using a secret.
  • @probot/serverless-gcf & probot-serverless-azurefunctions are very similar in terms of implementation. Only difference is that gcf doesn’t do any webhook secret verification, while probot-serverless-azurefunctions does it’s own instead of using Probots
  • @probot/serverless-gcf
    • doesn’t verify webhook secret.
    • It depends on internal APIs to find the apps private key and to resolve an app function. I think we should move these responsibilities to the user
    • has a hard-coded response to GET requests to mimick Probot’s server response to GET /probot
  • probot-serverless-azurefunctions
    • is currently doing its own signature verification.
    • It depends on internal APIs to find the apps private key and to resolve an app function. I think we should move these responsibilities to the user
    • has a hard-coded response to GET requests to mimick Probot’s server response to GET /probot
  • @probot/actions-adapter

to be continued …

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:25 (22 by maintainers)

github_iconTop GitHub Comments

4reactions
jetersencommented, Jan 4, 2021

@gr2m and co I just wanted to report back after upgrading to probot v11 and thank you for the work you done on v11. Probot is running super smooth!

Previously release-drafter was using probot v9 and we were daily seeing a lot of request timeouts (30s) on Heroku and Heroku had us on daily reboots sometimes more than once per day.

This is overview of the last 24 hours: image

4reactions
gr2mcommented, Nov 27, 2020

The pull request at https://github.com/probot/probot/pull/1425 moves all server logic from the Probot class into a new Server class, and exports two new methods relevant for serverless/function environments. I’d love feedback from anyone who is currently deploying Probot apps to a serverless/function environment or would like to do so in future.

The changes in https://github.com/probot/probot/pull/1425 are continuously published to probot’s beta channel. Install/update with npm install probot@beta

The exports are

const { createNodeMiddleware, getOptions } = require("probot")

They can be used together to create a (request, response, next) => { ... } middleware, compatible with both Node.js createServer and express. It can be used like this

const myApp = require('./my-app.js')

module.export = createNodeMiddleware(myApp, getOptions())

The getOptions method reads out environment variables and returns an object with a { Probot } key, where Probot is a constructor with defaults set from the environment variables.

This should work with out of the box with Architect, Vercel, and next.js. For other environments such as AWS Lambda, Azure Functions, or Google Cloud Functions, we would update the existing middleware implementations, probably keeping them as external packages instead of baking them into probot.

If you have any thoughts, if you see any problems I’ve overseen or can think of ways to make the APIs easier or more efficient, now is the time to share 👍🏼

@SamStenton, @ethomson, @imwiss, @gwestersf, @JasonEtco, @tcbyrd, @swinton

Read more comments on GitHub >

github_iconTop Results From Across the Web

Function - AWS Serverless Application Model
Creates an AWS Lambda function, an AWS Identity and Access Management (IAM) execution role, and event source mappings that trigger the function.
Read more >
Probot on Twitter: " Are you deploying Probot to a serverless ...
Milestone : serverless/function runtime · Issue #1286 · probot/probot. This is just an early draft. Once Probot v10 is released (#1274), ...
Read more >
Azure Functions runtime 3.0 is now generally available
Azure Functions 3.0 is now generally available, so it's now possible to build and deploy functions with the 3.0 runtime version in production....
Read more >
Developing a fully Serverless Web app - Medium
When the Lambda functions are not in use, the cloud provider typically “spins down” the function. When they are invoked again, the function's...
Read more >
Python 3.9 runtime now available in AWS Lambda - Noise
You can alter the behavior of Python functions by using decorators. Previously, these could only consist of the @ symbol, a name, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found