File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ import protectedRoute from "./routes/protected.js";
6060import eventsPlugin from "./routes/events.js" ;
6161/** END ROUTES */
6262
63+ export const instanceId = randomUUID ( ) ;
64+
6365const __filename = fileURLToPath ( import . meta. url ) ;
6466const __dirname = path . dirname ( __filename ) ;
6567
Original file line number Diff line number Diff line change 11import awsLambdaFastify from "@fastify/aws-lambda" ;
2- import init from "./index.js" ;
2+ import init , { instanceId } from "./index.js" ;
33import { type APIGatewayEvent , type Context } from "aws-lambda" ;
44import { InternalServerError , ValidationError } from "common/errors/index.js" ;
55
@@ -9,7 +9,17 @@ const realHandler = awsLambdaFastify(app, {
99 serializeLambdaArguments : true ,
1010 callbackWaitsForEmptyEventLoop : false ,
1111} ) ;
12- const handler = async ( event : APIGatewayEvent , context : Context ) => {
12+ type WarmerEvent = { action : "warmer" } ;
13+ const handler = async (
14+ event : APIGatewayEvent | WarmerEvent ,
15+ context : Context ,
16+ ) => {
17+ if ( "action" in event ) {
18+ console . log ( `Got warmer event for instance ID ${ instanceId } .` ) ;
19+ return {
20+ instanceId,
21+ } ;
22+ }
1323 if ( process . env . ORIGIN_VERIFY_KEY ) {
1424 // check that the request has the right header (coming from cloudfront)
1525 if (
You can’t perform that action at this time.
0 commit comments