0

I have a problem with a lambda project in java, when the elements arrive to the queue, the lambda consumes them and when they are going to enter the lambda this error comes up

Failed to establish route, since neither were provided: 'spring.cloud.function.definition' as Message header or as application property or 'spring.cloud.function.routing-expression' as application property. Incoming message: GenericMessage [payload=byte[973], headers={aws-context=lambdainternal.api.LambdaContext@13b29b34, id=7e00385d-ff52-2e7e-0a6a-c68df012c679, timestamp=1685986732788}]: java.lang.IllegalStateException
java.lang.IllegalStateException: Failed to establish route, since neither were provided: 'spring.cloud.function.definition' as Message header or as application property or 'spring.cloud.function.routing-expression' as application property. Incoming message: GenericMessage [payload=byte[973], headers={aws-context=lambdainternal.api.LambdaContext@13b29b34, id=7e00385d-ff52-2e7e-0a6a-c68df012c679, timestamp=1685986732788}]
    at org.springframework.cloud.function.context.config.RoutingFunction.route(RoutingFunction.java:156)
    at org.springframework.cloud.function.context.config.RoutingFunction.apply(RoutingFunction.java:103)
    at org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper.doApply(SimpleFunctionRegistry.java:710)
    at org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper.apply(SimpleFunctionRegistry.java:562)
    at org.springframework.cloud.function.adapter.aws.FunctionInvoker.handleRequest(FunctionInvoker.java:113)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)*
jordanm
  • 33,009
  • 7
  • 61
  • 76
PereZix
  • 41
  • 4
  • The error says you need to provide configuration parameters that were not provided. – jordanm Jun 06 '23 at 15:09
  • what parameters and where? – PereZix Jun 06 '23 at 15:40
  • 1
    The error says you need to either set `spring.cloud.function.definition` or `spring.cloud.function.routing-expression`. If you're using spring boot, docs for configuration can be found here https://docs.spring.io/spring-boot/docs/1.5.6.RELEASE/reference/html/boot-features-external-config.html – jordanm Jun 06 '23 at 16:12
  • The error message could not have been more clear `since neither were provided: 'spring.cloud.function.definition' as Message header or as application property or 'spring.cloud.function.routing-expression' as application property.` as well as documentation - https://cloud.spring.io/spring-cloud-function/reference/html/spring-cloud-function.html#_function_routing – Oleg Zhurakousky Jun 12 '23 at 09:00
  • Yes, now it's working! thanks!! – PereZix Jun 12 '23 at 13:48

0 Answers0