fix(dynamodb): report a missing GSI on UpdateTable the way AWS does (#4564)

On AWS, deleting or updating a GSI the table does not have fails with
ResourceNotFoundException "Requested resource not found: Index <index>
for table <table>", with the table name even when TableName is an ARN.
Floci used its own message for a delete and a ValidationException for an
update.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-09-28 11:03:18 -04:00
1 parent 5e2edcb89b
commit e7e49f9125
3 files changed
+71 -4

No files matched your search

@@ -2306,8 +2306,7 @@ public class DynamoDbService {
for (String gsiName : gsiDeletes) {
if (table.findGsi(gsiName).isEmpty()) {
throw new AwsException("ResourceNotFoundException",
"Global secondary index " + gsiName + " does not exist on the table", 400);
throw missingGsi(gsiName, table.getTableName());
}
}
@@ -4803,6 +4802,11 @@ public class DynamoDbService {
}
}
static AwsException missingGsi(String indexName, String tableName) {
return new AwsException("ResourceNotFoundException",
"Requested resource not found: Index " + indexName + " for table " + tableName, 400);
}
public ImportTableDescription validateImportRequest(JsonNode request) {
if (request.path("S3BucketSource").path("S3Bucket").asText("").isBlank()) {
throw new AwsException("ValidationException", "S3BucketSource.S3Bucket is required", 400);
@@ -1728,8 +1728,7 @@ public class NativeDynamoDbJsonHandler {
"Cannot delete and update the same index: " + indexName, 400);
}
if (currentTable.findGsi(indexName).isEmpty()) {
throw new AwsException("ValidationException",
"The table does not have the specified index: " + indexName, 400);
throw DynamoDbService.missingGsi(indexName, currentTable.getTableName());
}
}
}