Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-cloudfront-s3: Adding custom lambda@edge to default behavior removes insertHttpSecurityHeaders lambda@edge #114

Closed
andrewgadziksonos opened this issue Jan 2, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@andrewgadziksonos
Copy link

Extending the defaultBehavior props with a custom lambda@edge removes the insertHttpSecurityHeaders lambda@edge configuration from the default cache behavior.

Reproduction Steps

const handler = new Function(scope, 'SomeHandler', {
  functionName: 'SomeHandler',
  runtime: Runtime.NODEJS_12_X,
  handler: 'index.handler',
  code: Code.fromAsset(path.join(__dirname, '../lambdas/function')),
})

const handlerVersion = new Version(scope, 'SomeHandlerVersion', {
  lambda: handler,
})

new CloudFrontToS3(scope, 'CloudFrontToS3', {
  cloudFrontDistributionProps: {
    defaultBehavior: {
       edgeLambdas: [
         {
           eventType: LambdaEdgeEventType.VIEWER_REQUEST,
           includeBody: false,
           functionVersion: handlerVersion,
         }
       ]
    }
})

Error Log

No errors produced, but CFN does not contain configuration for the insertHttpSecurityHeaders lambda@edge

Environment

  • **CDK CLI Version :1.80.0 (build 31132ca)
  • **CDK Framework Version:1.77.0
  • **AWS Solutions Constructs Version :1.77.0
  • **OS :MacOS 10.15.7 (19H114)
  • **Language :TypeScript

Other

const cfprops = cloudFrontDistributionProps ? overrideProps(defaultprops, cloudFrontDistributionProps) : defaultprops;

This line of code is causing the overrideProps function to overwrite arrays instead of merging them


This is 🐛 Bug Report

@andrewgadziksonos andrewgadziksonos added bug Something isn't working needs-triage The issue or PR still needs to be triaged labels Jan 2, 2021
@hnishar
Copy link
Contributor

hnishar commented Jan 12, 2021

andrewgadziksonos@ I'm able to reproduce the issue, the fix will be coming in the next release

@hnishar hnishar added in-progress This issue is being actively worked on and removed needs-triage The issue or PR still needs to be triaged labels Jan 12, 2021
@hnishar hnishar self-assigned this Jan 12, 2021
@hnishar hnishar removed the in-progress This issue is being actively worked on label Jan 14, 2021
@hnishar
Copy link
Contributor

hnishar commented Jan 14, 2021

andrewgadziksonos@ Fix has been pushed out in v1.81.0

@hnishar hnishar closed this as completed Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants