diff --git a/server/types/AwsEvent.d.ts b/server/types/AwsEvent.d.ts new file mode 100644 index 0000000..c4437ac --- /dev/null +++ b/server/types/AwsEvent.d.ts @@ -0,0 +1,5 @@ +import { AwsEvent, AwsCallback, AwsResponse } from "@slack/bolt/dist/receivers/AwsLambdaReceiver"; + +interface CustomAwsEvent extends AwsEvent { + source?: string; +} \ No newline at end of file diff --git a/server/utils/function/lambdaHandler/handler.ts b/server/utils/function/lambdaHandler/handler.ts index 9b91d2a..16bc7a0 100644 --- a/server/utils/function/lambdaHandler/handler.ts +++ b/server/utils/function/lambdaHandler/handler.ts @@ -4,14 +4,20 @@ import { submitNotionCommandHandler } from "../../../notion/blog/handler/submitN import { uploadNotionBlogViewHandler } from "../../../notion/blog/handler/uploadNotionBlogViewHandler"; import { app } from "../../appModule/slack/slack"; import { notion } from "../../appModule/notion/notion"; +import { CustomAwsEvent } from "../../../types/AwsEvent"; let handlerRegistered = false; export const handler = async( - event: AwsEvent, + event: CustomAwsEvent, context: any, callback: AwsCallback ): Promise => { + if(event.source === 'aws.events'){ + console.log('Warm Start 설정'); + return {statusCode:200, body:'Warm Start 완료'}; + } + if(!handlerRegistered){ submitNotionCommandHandler(app); uploadNotionBlogViewHandler(app, notion);