fix(lambdaweb): check the endpoint quota after the revisions an endpoint routes to (#6888)

Lambda refuses a missing or Failed revision, a Failed latest revision and
a connector revision on a PerRegion or MultiRegion endpoint before it
refuses an endpoint past the maxEndpointsPerFunction quota.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-10-28 22:35:14 -04:00
1 parent 42e7f6f2f3
commit a682400d45
3 files changed
+30 -4

No files matched your search

@@ -1052,10 +1052,6 @@ public class LambdaWebService implements Resettable {
if (fn.endpoints.containsKey(endpoint.endpointName)) {
throw new AwsException("ConflictException", "The endpoint " + endpoint.endpointName + " already exists.", 409);
}
if (fn.endpoints.size() >= MAX_ENDPOINTS_PER_FUNCTION) {
throw new AwsException("ServiceQuotaExceededException", "The function " + fn.functionArn
+ " has reached the maxEndpointsPerFunction quota of " + MAX_ENDPOINTS_PER_FUNCTION + ".", 402);
}
if (initialRevision != null) {
endpoint.revisionWeights = List.of(weight(initialRevision.revisionId, 100));
} else if (!endpoint.revisionWeights.isEmpty()) {
@@ -1063,6 +1059,10 @@ public class LambdaWebService implements Resettable {
} else {
endpoint.revisionWeights = latestRevision(fn).map(id -> List.of(weight(id, 100))).orElse(List.of());
}
if (fn.endpoints.size() >= MAX_ENDPOINTS_PER_FUNCTION) {
throw new AwsException("ServiceQuotaExceededException", "The function " + fn.functionArn
+ " has reached the maxEndpointsPerFunction quota of " + MAX_ENDPOINTS_PER_FUNCTION + ".", 402);
}
endpoint.endpointArn = fn.functionArn + "/endpoint/" + endpoint.endpointName;
endpoint.functionArn = fn.functionArn;
String host = URI.create(config.effectiveBaseUrl()).getAuthority();