question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong path in CloudFront invalidation on S3 BucketDeployment

See original GitHub issue

I’m using a S3BucketDeployment construct with a CloudFront distribution to deploy static content to a S3 bucket and, on deployment, invalidate items in the CF caches

new s3deploy.BucketDeployment(this, "DeployWebsite", {
      sources: [
        s3deploy.Source.asset(webAppRoot)
      ],
      destinationKeyPrefix: "web/",
      destinationBucket: bucket,
      distribution: cdn,
      retainOnDelete: false
    });

The origin in the CF distribution also specifies /web as its originPath. Upon deployment a new invalidation is created for the distribution, however the path for the objects to be invalidated is set to /web/*. Invalidation paths should be relative to the distribution, not to the origin (as per docs).

Reproduction Steps

The code causing the issue is here - https://github.com/dstroppa/aws-modern-application-workshop/blob/2f02430c5036517d34aeadda8e8bea9ffd7507ee/module-1/cdk/lib/web-application-stack.ts#L57

Error Log

N/A

Environment

  • CLI Version : 1.9.0
  • Framework Version: 1.9.0
  • OS : Linux
  • Language : Typescript

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
dstroppacommented, Oct 7, 2019

Thanks for looking into this @NGL321. Looks like the changes for #3878 affect CallerReference, but not distributionPaths.

0reactions
github-actions[bot]commented, Jun 28, 2022

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalidating files - Amazon CloudFront
To invalidate files, you can specify either the path for individual files or a path ... For example: aws cloudfront create-invalidation --distribution-id ...
Read more >
Invalidate Cloudfront cache with AWS CDK Pipelines
Is there a workaround? For example, in a non pipeline-process, something like this should work (what I've read): new s3deploy.BucketDeployment( ...
Read more >
AWS CDK BucketDeployment — should you use it - Medium
The construct looks like an attractive option for anyone looking at an easy way to manage that deployment and then to invalidate the...
Read more >
Deploy a website to S3 and CloudFront with Bitbucket Pipelines
The reason is, CloudFront is caching the all content on all edge locations and serving the content from edge locations. We should “invalidate ......
Read more >
awss3deployment - Go Packages
This library allows populating an S3 bucket with the contents of .zip files from other S3 ... The file paths to invalidate in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found