reviewbot

Source code for the is-a.dev r...
Log | Files | Refs | README | LICENSE

commit 56d6c286504c3982037c91089f4573ef0e150894
parent 957ca0232e2ac96aaeae6919ebc760e97496a72e
Author: iostpa <iostpa@iostpa.com>
Date:   Tue,  3 Mar 2026 17:40:36 +0200

Fix fastify not running

Diffstat:
Mbun.lock | 2+-
Mindex.js | 13+++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/bun.lock b/bun.lock @@ -6,7 +6,7 @@ "name": "reviewbot", "dependencies": { "@fastify/middie": "^9.2.0", - "@sentry/bun": "^10.41.0", + "@sentry/bun": "^10.42.0", "dotenv": "^17.3.1", "fastify": "^5.7.4", "octokit": "^5.0.5", diff --git a/index.js b/index.js @@ -66,6 +66,7 @@ app.webhooks.on('pull_request.opened', async ({ octokit, payload }) => { }; } catch (error) { Sentry.captureException(error); + fastify.log.error(error); if (error.response) { console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`); } else { @@ -89,6 +90,7 @@ app.webhooks.on('pull_request.closed', async ({ octokit, payload }) => { } else { return; }; } catch (error) { Sentry.captureException(error); + fastify.log.error(error); if (error.response) { console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`); } else { @@ -115,6 +117,7 @@ app.webhooks.on('workflow_run.completed', async ({ octokit, payload }) => { } else { return; }; } catch (error) { Sentry.captureException(error); + fastify.log.error(error); if (error.response) { console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`); } else { @@ -170,6 +173,7 @@ ${finalLogs.join('\n').replace(/</g, '&lt;').replace(/>/g, '&gt;')} } } catch (error) { Sentry.captureException(error); + fastify.log.error(error); if (error.response) { console.error(`Error! Status: ${error.response.status}. Message: ${error.response.data.message}`); } else { @@ -181,6 +185,7 @@ ${finalLogs.join('\n').replace(/</g, '&lt;').replace(/>/g, '&gt;')} // Handle errors app.webhooks.onError((error) => { Sentry.captureException(error); + fastify.log.error(error); if (error.name === 'AggregateError') { // Log Secret verification errors console.log(`Error processing request: ${error.event}`); @@ -192,11 +197,11 @@ app.webhooks.onError((error) => { // Launch a web server to listen for GitHub webhooks const port = process.env.PORT || 3000; const host = process.env.NODE_ENV === 'production' ? '0.0.0.0' : 'localhost'; -const path = '/api/webhook'; -const localWebhookUrl = `http://${host}:${port}${path}`; +const webhookPath = '/api/webhook'; +const localWebhookUrl = `http://${host}:${port}${webhookPath}`; // https://github.com/octokit/webhooks.js/#createnodemiddleware -const middleware = createNodeMiddleware(app.webhooks, { path }); +const middleware = createNodeMiddleware(app.webhooks, { webhookPath }); const fastify = Fastify({ logger: false @@ -204,7 +209,7 @@ const fastify = Fastify({ await fastify.register(middie); fastify.use(middleware); -fastify.listen({ port }, () => { +await fastify.listen({ port }, () => { console.log(`Server is listening for events at: ${localWebhookUrl}`); console.log('Press Ctrl + C to quit.'); });
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror