Using Octokit 3.1.2, this does not work:
import { createServer } from "node:http"
import { App, createNodeMiddleware } from "octokit"
const app = new App({
...
})
createServer(createNodeMiddleware(app.webhooks, { path: "/myapi/github/webhooks" })).listen(3001)
The middleware rejects all requests.
This is because the options for Middleware have changed, as per this documentation on octokit/app.js. The above code must be changed to the following to work:
Note that both the behavior (path is now a path prefix) and the default value (
/api/github/webhooks
->/api/github
) have changed!This burned over five hours of my time! I filed a bug here. https://github.com/octokit/webhooks.js/issues/946