Skip to content

Commit 0745581

Browse files
committed
Fix process file resource in API Gateway
1 parent aad05e9 commit 0745581

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

backend/src/iac/backend-stack.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,9 @@ export class BackendStack extends cdk.Stack {
372372
// Create the 'status' resource under ':id'
373373
const reportStatusResource = reportIdResource.addResource('status');
374374

375+
// Create the 'process-file' resource under ':id'
376+
const processFileResource = reportIdResource.addResource('process-file');
377+
375378
// Define integration options once for reuse
376379
const integrationOptions = {
377380
connectionType: apigateway.ConnectionType.VPC_LINK,
@@ -465,7 +468,7 @@ export class BackendStack extends cdk.Stack {
465468
});
466469

467470
// Add POST method to process file
468-
reportIdResource.addMethod('POST', processFileIntegration, {
471+
processFileResource.addMethod('POST', processFileIntegration, {
469472
...methodOptions,
470473
requestParameters: {
471474
'method.request.path.id': true,
@@ -506,6 +509,10 @@ export class BackendStack extends cdk.Stack {
506509
...corsOptions,
507510
allowCredentials: false,
508511
});
512+
processFileResource.addCorsPreflight({
513+
...corsOptions,
514+
allowCredentials: false,
515+
});
509516

510517
// Configure Gateway Responses to add CORS headers to error responses
511518
const gatewayResponseTypes = [

0 commit comments

Comments
 (0)