Skip to content

Commit

Permalink
Merge pull request #88 from CoSchedule/non-rewriter-dependency
Browse files Browse the repository at this point in the history
fix: Make sure lambda always has a dependency on S3 assets
  • Loading branch information
revmischa authored Mar 9, 2023
2 parents a13cd65 + 23cdcce commit 13f2019
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Nextjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ export class Nextjs extends Construct {
// finish static deployment BEFORE deploying new function code
// as there is some time after the new static files are uploaded but before they are rewritten
const rewriter = this.assetsDeployment.rewriter?.rewriteNode;
if (rewriter) this.serverFunction.lambdaFunction.node.addDependency(rewriter);
if (rewriter) {
this.serverFunction.lambdaFunction.node.addDependency(rewriter);
} else {
this.serverFunction.lambdaFunction.node.addDependency(...this.assetsDeployment.deployments);
}

this.distribution = new NextjsDistribution(this, 'Distribution', {
...props,
Expand Down

0 comments on commit 13f2019

Please sign in to comment.