Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/src/lambda-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export async function handler(

const BUCKET_NAME = process.env.S3_BUCKET_NAME;
const CLOUDFRONT_DISTRIBUTION_ID = process.env.CLOUDFRONT_DISTRIBUTION_ID;
const key = "website/data/rolling-images.json";
const key = process.env.S3_OBJECT_KEY ?? "website/data/rolling-images.json";
const cloudfrontInvalidationPath =
process.env.CLOUDFRONT_INVALIDATION_PATH ??
`/${key.replace(/^website\//, "")}`;
Comment on lines +40 to +43

if (!BUCKET_NAME) {
console.error("Missing required environment variable: S3_BUCKET_NAME");
Expand Down Expand Up @@ -107,7 +110,7 @@ export async function handler(
CallerReference: `lambda-${Date.now()}`,
Paths: {
Quantity: 1,
Items: [`/${key.replace("website/", "")}`],
Items: [cloudfrontInvalidationPath],
},
},
});
Expand Down