meeza
meeza

Reputation: 704

AWS Lambda invoke exception "No LambdaFunction annotation for method invoke"

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?

Upvotes: 0

Views: 831

Answers (1)

meeza
meeza

Reputation: 704

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);

Upvotes: 1

Related Questions