From e0741c70b86c31483d4b7937cc7381a53125510a Mon Sep 17 00:00:00 2001 From: rayangler <27821750+rayangler@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:45:39 -0400 Subject: [PATCH] Fix githubEndpoint trigger resource (#893) --- cdk-infra/lib/constructs/api/webhook-api-construct.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cdk-infra/lib/constructs/api/webhook-api-construct.ts b/cdk-infra/lib/constructs/api/webhook-api-construct.ts index bbfaf33f1..52c71b95f 100644 --- a/cdk-infra/lib/constructs/api/webhook-api-construct.ts +++ b/cdk-infra/lib/constructs/api/webhook-api-construct.ts @@ -133,6 +133,9 @@ export class WebhookApiConstruct extends Construct { const localEndpoint = webhookEndpoint.addResource('local'); const snootyEndpoint = webhookEndpoint.addResource('snooty'); + // Shared /githubEndpoint/trigger endpoint + const githubEndpointTrigger = githubEndpoint.addResource('trigger'); + const defaultCorsPreflightOptions: CorsOptions = { allowOrigins: Cors.ALL_ORIGINS, }; @@ -153,13 +156,11 @@ export class WebhookApiConstruct extends Construct { .addResource('upsert', { defaultCorsPreflightOptions }) .addMethod('POST', new LambdaIntegration(dochubTriggerUpsertLambda)); - githubEndpoint - .addResource('trigger') + githubEndpointTrigger .addResource('build', { defaultCorsPreflightOptions }) .addMethod('POST', new LambdaIntegration(githubTriggerLambda)); - githubEndpoint - .addResource('trigger') + githubEndpointTrigger .addResource('delete', { defaultCorsPreflightOptions }) .addMethod('POST', new LambdaIntegration(githubDeleteArtifactsLambda));