diff --git a/lib/utils/aws/Misc.js b/lib/utils/aws/Misc.js index 9fd096ee8..681f4373d 100644 --- a/lib/utils/aws/Misc.js +++ b/lib/utils/aws/Misc.js @@ -48,7 +48,14 @@ module.exports.getConfigDir = function() { module.exports.profilesMap = function() { let credsPath = path.join(this.getConfigDir(), 'credentials'); - return AWS.util.ini.parse(AWS.util.readFileSync(credsPath)); + + try { + return AWS.util.ini.parse(AWS.util.readFileSync(credsPath)); + } + catch (e) { + return []; + } + }; /** @@ -62,6 +69,7 @@ module.exports.profilesGet = function(awsProfile) { if (!profiles[awsProfile]) { throw new SError(`Cant find profile ${awsProfile} in ~/.aws/credentials`, awsProfile); } + return profiles; };