title: AWS Kinesis Firehose to Lambda , Lambda to S3 using java
body: <p>For my expolartion , created AWS firehose stream and configured Lambda function and  move the data to S3. Firehose to S3 it is working fine without any issue. If i enable lamda function, getting below error in S3 failed bucket.</p>
  
  <pre><code>{"attemptsMade":4,"arrivalTimestamp":1570727830210,"errorCode":"Lambda.FunctionError","errorMessage":"The Lambda function was successfully invoked but it returned an error result."
  </code></pre>
  
  <p>lambda java code:</p>
  
  <pre><code>public class LambdaFunctionHandler implements RequestHandler&lt;KinesisEvent, String&gt; {
  
      @Override
      public String handleRequest(KinesisEvent event, Context context) {
          context.getLogger().log("Input: " + event);
          StringBuffer sb = new StringBuffer();
          for (KinesisEventRecord record : event.getRecords()) {
              String payload = new String(record.getKinesis().getData().array());
              if (payload.toLowerCase().contains("scala"))
                  sb.append(payload);
              sb.append("\n");
          }
  
          return sb.toString();
      }
  }
  </code></pre>
  
  <p>Basically , filter incoming streaming data and push to S3.  Also I have frw questions.
  1 . i am passing punch JSON data to firehose. "record.getKinesis().getData()" method will read the record line by line and bunch to entire json string.
  2. written log statment. where to check my log.
  How can i handle this scenario? please advise</p>