Programatic start
See original GitHub issueFeature Request
Is your feature request related to a problem? Please describe.
Zeit Now 2.0 expects a function that accepts the standard Node.js request
and response
objects. In order to get this function, I need to use createProbot
, load my Probot appFn
, and expose probot.webhook.middleware
.
// Simplified for clarity
const { createProbot } = require('probot')
const app = require('../')
const probot = createProbot({
id: process.env.APP_ID,
secret: process.env.WEBHOOK_SECRET,
cert: process.env.PRIVATE_KEY
})
probot.load(app)
module.exports = probot.webhook.middleware
Describe the solution you’d like There seem to be a few use cases that could benefit from a programatic start (probot/friction#8, #780)
This code above is similar to what is suggested in both linked issues, and seems like a reasonable way to implement it. However, it would be nice to have some sort of function to take care of some of the configuration logic. Discussing with @JasonEtco on slack he mentioned a programatic start like this would be something nice to have within Probot itself.
Describe alternatives you’ve considered
Another approach, or perhaps complimentary to the above suggestion, would be to create a serverless-now
package similar to probot/serverless-lambda.
The simplest thing could be to just update the documentation for deploying to Zeit Now that explains how to deploy with the 2.0 API.
Teachability, Documentation, Adoption, Migration Strategy
Not sure I have much more to add here, other than I’d be happy to help out. I was planning to write a simple blog post about it, so I could morph that into a PR for the docs. I could create a serverless-now
package (which I’ll probably do on my own if it’s not something Probot wants to manage. Lastly I could look into implementing the programatic start into Probot itself, but realistically I won’t have the time to start on this for at least a week or two.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:13 (6 by maintainers)
Top GitHub Comments
Being able to programmatically start probot and exposing the middleware, which receives client request and server response, would probably make further integrations a lot easier.
Coincidentally, I just published an implementation for now v2 based on the lambda version here https://github.com/passionkind/probot-serverless-now
https://www.npmjs.com/package/probot-serverless-now is another package for running Probot on Now v2. It has the benefit of being closer to the original Probot runtime. Indeed, it supports: