From 213df781ea8093c31dc26650b2e419604d49fab8 Mon Sep 17 00:00:00 2001 From: Matthew Robertson Date: Thu, 27 Mar 2025 21:17:17 +0000 Subject: [PATCH] fix: correct handling of IGNORED_ROUTES set to empty --- src/server.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/server.ts b/src/server.ts index fbf565c6c..9a9b3acc3 100644 --- a/src/server.ts +++ b/src/server.ts @@ -136,10 +136,13 @@ export function getServer( } if (options.ignoredRoutes !== null) { // Ignored routes is a configuration option that allows requests to specific paths to be prevented - // from invoking the user's function. - app.use(options.ignoredRoutes, (req, res) => { - res.status(404).send(null); - }); + // from invoking the user's function. An empty string indicates that no routes should be filtered. + if (options.ignoredRoutes.trim() !== '') { + // Any non-empty string is the used a route expression to return 404 for. + app.use(options.ignoredRoutes, (req, res) => { + res.status(404).send(null); + }); + } } else if (options.signatureType === 'http') { // We configure some default ignored routes, only for HTTP functions. app.use('/favicon.ico|/robots.txt', (req, res) => {