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

fix: Change prune default to false to fix 404s #219

Merged
merged 5 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading