fix(lambda): refuse a log level under Text as Lambda does (#5920)

Floci accepted ApplicationLogLevel and SystemLogLevel under Text and
dropped them, which a test pinned and the docs described as Floci's own
call rather than probed behaviour. Measured on Lambda (eu-west-1,
2026-10-18): CreateFunction and UpdateFunctionConfiguration refuse either
level under Text, whether LogFormat names Text or is left to that
default, with InvalidParameterValueException "LogLevel is not supported
when LogFormat is set to "Text". Remove LogLevel from your request or
change the LogFormat to "JSON" and try again." In a stack, a valid level
under Text passes the template's validation and fails the resource with
Lambda's message. Floci now refuses it in validateLoggingConfig, so the
API and the CloudFormation update check, which validates through
loggingSettings, both do; and its enum errors list the levels in Lambda's
order: [FATAL, TRACE, WARN, ERROR, INFO, DEBUG] and [WARN, INFO, DEBUG].

The default format is worked out in one place, logFormat, for the
validation and for loggingSettings.

Tests: a level under Text refused on create and on update through the API
(LambdaVpcSnapStartLoggingIntegrationTest, replacing the test that pinned
the old behaviour) and through the SDK (LambdaFunctionConfigTest), by
loggingSettings (LambdaServiceTest), and by a stack update
(CloudFormationLambdaLoggingConfigIntegrationTest); the enum messages'
order. They fail on main.
This commit is contained in:
Alessandro Lattao authored and GitHub committed 2026-10-18 08:10:40 -04:00
1 parent 5a4413d63a
commit d425e2d884
6 files changed
+163 -48

No files matched your search

@@ -328,4 +328,35 @@ class LambdaFunctionConfigTest {
}
}
}
@Test
@Order(8)
@DisplayName("a log level under Text is refused on create and on update, as Lambda refuses it")
void logLevelUnderTextIsRefused() {
// Measured on Lambda (eu-west-1, 2026-10-18), with the format named or left to its default.
String refused = "LogLevel is not supported when LogFormat is set to \"Text\". Remove LogLevel from your "
+ "request or change the LogFormat to \"JSON\" and try again.";
assertThatThrownBy(() -> lambda.createFunction(CreateFunctionRequest.builder()
.functionName(TestFixtures.uniqueName("fn-text-level"))
.runtime(Runtime.NODEJS20_X)
.role(ROLE)
.handler("index.handler")
.code(FunctionCode.builder()
.zipFile(SdkBytes.fromByteArray(LambdaUtils.minimalZip()))
.build())
.loggingConfig(LoggingConfig.builder()
.logFormat(LogFormat.TEXT)
.applicationLogLevel(ApplicationLogLevel.WARN)
.build())
.build()))
.isInstanceOf(InvalidParameterValueException.class)
.hasMessageContaining(refused);
assertThatThrownBy(() -> lambda.updateFunctionConfiguration(UpdateFunctionConfigurationRequest.builder()
.functionName(FN)
.loggingConfig(LoggingConfig.builder().systemLogLevel(SystemLogLevel.WARN).build())
.build()))
.isInstanceOf(InvalidParameterValueException.class)
.hasMessageContaining(refused);
}
}