0

I am invoking a Lambda function from my Java code that is running inside Spark process.

The invocation is failing with following exception:

23:22:50,043 ERROR com.gravty.batch.process.BitProcessImpl - com.amazonaws.services.lambda.invoke.LambdaSerializationException: No LambdaFunction annotation for method invoke

Does anyone has any idea about this error?

Darshan Patel
  • 2,839
  • 2
  • 25
  • 38
meeza
  • 664
  • 1
  • 9
  • 20

1 Answers1

1

Resolved it by using interface with @LambdaFunction annotation.

my lambda interface:

public interface MyLambdaService {
    @LambdaFunction
    ApiGatewayProxyResponse execute(ApiGatewayRequest bit);
}

this is how I created the lambda client:

MyLambdaService lambdaService = LambdaInvokerFactory.builder().lambdaClient(AWSLambdaClientBuilder.defaultClient())
                    .lambdaFunctionNameResolver((method, annotation, config) -> "ENV_SPECIFIC_FUNCTION_NAME").build(MyLambdaService.class);
meeza
  • 664
  • 1
  • 9
  • 20