Skip to content

Commit

Permalink
fix: create lambda folder on demand
Browse files Browse the repository at this point in the history
  • Loading branch information
hoegertn committed May 20, 2021
1 parent e489277 commit ff6c6ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/constructs/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ export class HttpWebhook extends cdk.Construct {
private createHandler() {
const description = `Webhook ${this.props.name}`;

const entryFile = `./src/lambda/webhook.${this.props.name.replace(/[^\w-]/g, '-')}.ts`;
const entryFile = `./src/lambda/webhook.${this.props.name.toLowerCase().replace(/[^\w-]/g, '-')}.ts`;
if (!fs.existsSync(entryFile)) {
fs.mkdirSync('./src/lambda', { recursive: true });
fs.writeFileSync(entryFile, `import { http, errors } from '@taimos/lambda-toolbox';
import { operations } from './types.generated';
export const handler = http.createHttpHandler<any, any>(async (ctx) => {
ctx.logger.info(JSON.stringify(ctx.event));
Expand Down

0 comments on commit ff6c6ca

Please sign in to comment.