From 3e570577b2056591326c0935896ac47990118ec9 Mon Sep 17 00:00:00 2001 From: "Jocelyn Badgley (Twipped)" Date: Wed, 25 Aug 2021 09:22:39 -0700 Subject: [PATCH] more aws graceful --- gulp/cloudfront.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gulp/cloudfront.js b/gulp/cloudfront.js index d45feca..9bb53f9 100644 --- a/gulp/cloudfront.js +++ b/gulp/cloudfront.js @@ -1,9 +1,20 @@ const log = require('fancy-log'); const aws = require('aws-sdk'); -var credentials = require('../aws.json'); var Promise = require('bluebird'); +var credentials; +try { + credentials = require('../aws.json'); +} catch (e) { + credentials = null; +} + async function invalidate (wait) { + if (!credentials) { + console.error('Cannot access cloudfront without AWS credentials present.'); // eslint-disable-line + return false; + } + var cloudfront = new aws.CloudFront(); cloudfront.config.update({ credentials });