From b9cd3ec1a646adffbc3cf2e8bdac534d7c3e3449 Mon Sep 17 00:00:00 2001 From: Edd Date: Fri, 17 Nov 2023 10:56:43 +0000 Subject: [PATCH] fix: default empty array for functions (#6184) --- src/commands/logs/functions.mts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/commands/logs/functions.mts b/src/commands/logs/functions.mts index 68b0c3a8676..d8080d8b5fc 100644 --- a/src/commands/logs/functions.mts +++ b/src/commands/logs/functions.mts @@ -30,7 +30,12 @@ const logsFunction = async (functionName: string | undefined, options: OptionVal const { site } = command.netlify const { id: siteId } = site - const { functions } = await client.searchSiteFunctions({ siteId }) + const { functions = [] } = await client.searchSiteFunctions({ siteId }) + + if (functions.length === 0) { + log(`No functions found for the site`) + return + } let selectedFunction if (functionName) {