Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
environment: {
DATA_BUCKET: `${bucket.bucketName}`,
MAIL_NAME: `${mailName}`,
MAIL_USER: `${mailUser}`,
MAIL_PASS: `${mailPass}`,
MAIL_HOST: `${mailHost}`,
MAIL_PORT: `${mailPort}`,
MAIL_REPLY_TO: `${mailReplyTo}`,
DROPBOX_TOKEN: `${dropboxToken}`,
SNS_TOPIC_ARN: `${snsTopicArn}`,
SENTRY_DSN: `${sentryDsn}`
}
});
bucket.grantReadWrite(lambdaFn);
const snsTopic = Topic.fromTopicArn(
this,
'SendThatInvoice',
`${snsTopicArn}`
);
snsTopic.grantPublish(lambdaFn);
// Run every day at 6PM UTC
// See https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html
const rule = new events.Rule(this, 'send-that-invoice-cron-rule', {
schedule: events.Schedule.expression('rate(4 hours)')
});
rule.addTarget(new targets.LambdaFunction(lambdaFn));
} else {
console.error(
'It seems you haven\'t set one of your ENV vars correctly, please check below'