Skip to content

Commit

Permalink
Handle CDN invalidations only if CDN explicitly enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
DocLM committed Jun 6, 2024
1 parent 202f840 commit 280a5a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sam/02-after/00-get-app-apex/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module.exports = function getAppApex (params, callback) {
else callback()
},
function invalidateS3 (callback) {
if (s3 && !creatingS3 && !enablingS3 && !destroyingS3) {
if (cdnEnabled && s3 && !creatingS3 && !enablingS3 && !destroyingS3) {
update.status('Invalidating static asset (S3) CDN distribution cache')
aws.cloudfront.CreateInvalidation({
Id: s3.id,
Expand Down Expand Up @@ -132,7 +132,7 @@ module.exports = function getAppApex (params, callback) {
else callback()
},
function invalidateApiGateway (callback) {
if (apigateway && !creatingApiGateway && !enablingApiGateway && !destroyingApiGateway) {
if (cdnEnabled && apigateway && !creatingApiGateway && !enablingApiGateway && !destroyingApiGateway) {
update.status('Invalidating API Gateway CDN distribution cache')
aws.cloudfront.CreateInvalidation({
Id: apigateway.id,
Expand Down

0 comments on commit 280a5a5

Please sign in to comment.