When I am trying to invoke a Lambda function (below is my code) , I am getting an error in CloudWatch Logs saying the input is not a valid Base-64 string.
String payload = "xxxxxxxxxxx";
SdkBytes payloadBytes = SdkBytes.fromUtf8String(payload);
String routingUri = getRoutingUri();
InvokeRequest invokeRequest = InvokeRequest.builder()
.functionName(routingUri)
.payload(payloadBytes)
.invocationType("RequestResponse")
.build();
InvokeResponse result = lambdaClient.invoke(invokeRequest);
Error : System.FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
I tried various ways to encode the request in Base-64 but nothing seems to be working
- My AWS SDK version is 2.15.14
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.15.14</version>
</dependency>
Please Help.
Here you need to endcode the string using Base64.Encoder from java.util package