From 099d187719efb5ade5142cb150731b6146bed440 Mon Sep 17 00:00:00 2001 From: Aman Kumar Date: Fri, 7 Feb 2025 18:51:34 +0530 Subject: [PATCH] fix: TypeError: handler is not a function --- src/util/cloud-function/cloud-functions.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/util/cloud-function/cloud-functions.ts b/src/util/cloud-function/cloud-functions.ts index 179e33e..4207ee4 100755 --- a/src/util/cloud-function/cloud-functions.ts +++ b/src/util/cloud-function/cloud-functions.ts @@ -71,9 +71,10 @@ export class CloudFunctions { ): Promise { await Promise.all( cloudFunctionResources.map(async (cloudFunctionResource) => { - const handler = await import( - `${cloudFunctionResource.cloudFunctionFilePath}` - ); + // Import the cloud function dynamically using the import() syntax + const { default: handler } = await import( + `${cloudFunctionResource.cloudFunctionFilePath}` + ); app.use(express.json()); app.use(express.urlencoded({ extended: true }));