Skip to content

Commit

Permalink
fix: Change prune default to false to fix 404s (#219)
Browse files Browse the repository at this point in the history
* Change prune default to false to fix 404s

* Update NextjsBucketDeployment.ts

* chore: self mutation

Signed-off-by: github-actions <[email protected]>

* Update NextjsStaticAssets.ts

* Update NextjsBucketDeployment.ts

---------

Signed-off-by: github-actions <[email protected]>
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
bestickley and github-actions authored Jul 15, 2024
1 parent 8e1e853 commit d06e715
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
10 changes: 8 additions & 2 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/NextjsBucketDeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export interface NextjsBucketDeploymentProps {
* Old objects are determined by listing objects
* in bucket before creating new objects and finding the objects that aren't in
* the new objects.
* @default true
*
* Note, if this is set to true then clients who have old HTML files (browser tabs opened before deployment)
* will reference JS, CSS files that do not exist in S3 reslting in 404s.
* @default false
*/
readonly prune?: boolean | undefined;
/**
Expand Down Expand Up @@ -143,7 +146,7 @@ export class NextjsBucketDeployment extends Construct {
destinationBucketName: this.props.destinationBucket.bucketName,
destinationKeyPrefix: this.props.destinationKeyPrefix,
putConfig: this.props.putConfig,
prune: this.props.prune,
prune: this.props.prune ?? false,
substitutionConfig: this.props.substitutionConfig,
zip: this.props.zip,
};
Expand Down
2 changes: 1 addition & 1 deletion src/NextjsStaticAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class NextjsStaticAssets extends Construct {
// only put env vars that are placeholders in custom resource properties
// to be replaced. other env vars were injected at build time.
substitutionConfig: NextjsBucketDeployment.getSubstitutionConfig(this.buildEnvVars),
prune: this.props.prune === false ? false : true, // default to true
prune: this.props.prune, // defaults to false
putConfig: {
[allFiles]: {
CacheControl: 'public, max-age=0, must-revalidate',
Expand Down
5 changes: 4 additions & 1 deletion src/generated-structs/OptionalNextjsBucketDeploymentProps.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d06e715

Please sign in to comment.