Skip to content

Commit

Permalink
fix: passing env to cron lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
debrecenid committed Nov 7, 2023
1 parent 89c51d2 commit 1cc3eb4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions stacks/CronStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,30 @@ import { ConfigStack } from "./ConfigStack";
export function CronStack({ stack }: StackContext) {
const secrets = use(ConfigStack);

const environment = {
DB_URL: process.env.DB_URL || "",
};

const icebreakerCron = new Cron(stack, "Cron", {
job: "packages/functions/cron/iceBreakerQuestions.handler",
job: {
function: {
environment,
handler: "packages/functions/cron/iceBreakerQuestions.handler",
},
},
// Every first Tuesday of the month at 11:00 UTC
schedule: "cron(0 11 ? * 3#1 *)",
});

icebreakerCron.bind(secrets);

const dailyCron = new Cron(stack, "DailyCron", {
job: "packages/functions/cron/daily.handler",
job: {
function: {
environment,
handler: "packages/functions/cron/daily.handler",
},
},
// Every day at 11:00 UTC
schedule: "cron(0 11 ? * * *)",
});
Expand Down

0 comments on commit 1cc3eb4

Please sign in to comment.