fix(lambdaweb): refuse a function name another region already has (#6409)

* fix(lambdaweb): refuse a function name another region already has

AWS keeps web function names unique across the regions of an account.
CreateWebFunction with a name another region has is 409
ConflictException "A function named <name> already exists in the
account. Function names must be unique across all regions in an
account.", at the same point as the same-region conflict.

* fix(lambdaweb): key the function name lock by account

* perf(lambdaweb): find a name in other regions without copying every key
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-10-24 08:37:19 -04:00
1 parent 3b4589645b
commit 4e0bf080ed
3 files changed
+32 -9

No files matched your search

@@ -571,6 +571,18 @@ class LambdaWebIntegrationTest {
.when().put(BASE + "/web-functions")
.then().statusCode(409)
.body("message", equalTo("The function " + ARN + " already exists."));
given().contentType("application/json")
.header("Authorization", "AWS4-HMAC-SHA256 Credential=test/20260101/us-west-2/lambda/aws4_request")
.body("""
{"functionName": "%s",
"revisionConfig": {"buildConfig": %s, "serviceConfig": {"executionRoleArn": "%s"}},
"endpointConfig": {"endpointName": "dev", "endpointType": "HomeRegion",
"authType": "ApplicationManaged"}}
""".formatted(FN, BUILD.replace("nodejs24.x", "nodejs22.x"), ROLE))
.when().put(BASE + "/web-functions")
.then().statusCode(409)
.body("message", equalTo("A function named " + FN + " already exists in the account. Function names"
+ " must be unique across all regions in an account."));
given().when().get(BASE + "/web-functions/does-not-exist")
.then().statusCode(404)
.body("message", equalTo("The function arn:aws:lambda:us-east-1:000000000000:web-function/does-not-exist"