diff --git a/lib/LambdaManager.js b/lib/LambdaManager.js index e2b4bc8..4127736 100644 --- a/lib/LambdaManager.js +++ b/lib/LambdaManager.js @@ -88,7 +88,15 @@ LambdaManager.prototype.cleanupProduction = async function(functionName, forceRe await this.LambdaFactory.deleteAlias({ FunctionName: functionName, Name: alias }).promise(); } } - await this.LambdaFactory.deleteFunction({ FunctionName: functionName, Qualifier: versionData.Version }).promise(); + try { + await this.LambdaFactory.deleteFunction({ FunctionName: functionName, Qualifier: versionData.Version }).promise(); + } catch (error) { + if (error.code === 'ResourceConflictException' && error.message.startsWith('Unable to delete version because the following aliases reference it:')) { + continue; + } + console.log(` Failed to delete version, due to error: (${error.code}) ${error.message}`); + throw error; + } } } };