Skip to content

Commit

Permalink
Ignore deleting function versions when there is an alias still attached.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Dec 19, 2024
1 parent ccb0369 commit d8f55ee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/LambdaManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
};
Expand Down

0 comments on commit d8f55ee

Please sign in to comment.