diff --git a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/CustomRuntimeEventLoop.java b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/CustomRuntimeEventLoop.java index 499297c64..83d9f256d 100644 --- a/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/CustomRuntimeEventLoop.java +++ b/spring-cloud-function-adapters/spring-cloud-function-adapter-aws/src/main/java/org/springframework/cloud/function/adapter/aws/CustomRuntimeEventLoop.java @@ -174,25 +174,33 @@ public final class CustomRuntimeEventLoop implements SmartLifecycle { private FunctionInvocationWrapper locateFunction(Environment environment, FunctionCatalog functionCatalog, MediaType contentType) { String handlerName = environment.getProperty("DEFAULT_HANDLER"); + if (logger.isDebugEnabled()) { + logger.debug("Value of DEFAULT_HANDLER env: " + handlerName); + } FunctionInvocationWrapper function = functionCatalog.lookup(handlerName, contentType.toString()); if (function == null) { + logger.debug("Could not locate function under DEFAULT_HANDLER"); handlerName = environment.getProperty("_HANDLER"); + if (logger.isDebugEnabled()) { + logger.debug("Value of _HANDLER env: " + handlerName); + } function = functionCatalog.lookup(handlerName, contentType.toString()); } if (function == null) { - function = functionCatalog.lookup(null, contentType.toString()); + logger.debug("Could not locate function under _HANDLER"); + function = functionCatalog.lookup((String) null, contentType.toString()); } if (function == null) { + logger.info("Could not determine default function"); handlerName = environment.getProperty("spring.cloud.function.definition"); + if (logger.isDebugEnabled()) { + logger.debug("Value of 'spring.cloud.function.definition' env: " + handlerName); + } function = functionCatalog.lookup(handlerName, contentType.toString()); } - if (function == null) { - function = functionCatalog.lookup(null, contentType.toString()); - } - Assert.notNull(function, "Failed to locate function. Tried locating default function, " + "function by 'DEFAULT_HANDLER', '_HANDLER' env variable as well as'spring.cloud.function.definition'. " + "Functions available in catalog are: " + functionCatalog.getNames(null));