From f7a7b1b29ebee3436a6bd52f4a903358c399ae6c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 24 Nov 2025 13:04:47 +0100 Subject: [PATCH] Log incoming requests and add 404 handler for webhook server --- src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.ts b/src/index.ts index 7a401bb79..29daa1b57 100644 --- a/src/index.ts +++ b/src/index.ts @@ -328,6 +328,12 @@ async function startWebhook( // Twilio sends application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })); + app.use((req, _res, next) => { + if (verbose) { + console.log(chalk.gray(`REQ ${req.method} ${req.url}`)); + } + next(); + }); app.post(path, async (req: Request, res: Response) => { const { From, To, Body, MessageSid } = req.body ?? {}; @@ -365,6 +371,10 @@ async function startWebhook( res.type('text/xml').send(''); }); + app.use((req, res) => { + res.status(404).send('warelay webhook: not found'); + }); + return new Promise((resolve) => { app.listen(port, () => { console.log(`📥 Webhook listening on http://localhost:${port}${path}`);