Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit f5c33ac

Browse files
feat: allow to set custom handler (#2409)
1 parent e7af519 commit f5c33ac

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

packages/serverless-components/nextjs-cdk-construct/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export class NextJSLambdaEdge extends Construct {
151151
this.defaultNextLambda = new lambda.Function(this, "NextLambda", {
152152
functionName: toLambdaOption("defaultLambda", props.name),
153153
description: `Default Lambda@Edge for Next CloudFront distribution`,
154-
handler: "index.handler",
154+
handler: props.handler || "index.handler",
155155
currentVersionOptions: {
156156
removalPolicy: RemovalPolicy.DESTROY // destroy old versions
157157
},

packages/serverless-components/nextjs-cdk-construct/src/props.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ export interface Props extends StackProps {
6363
imageCache?: string;
6464
lambdaCache?: string;
6565
};
66+
/**
67+
* If you use a custom handler with `.build()`, you can set the handler here.
68+
*/
69+
handler?: string;
70+
6671
/**
6772
* Enable logging on the cloudfront distribution
6873
*/

0 commit comments

Comments
 (0)