title: Spring Cloud Function Was S3Event error converting generic message
body: <p>I'm using the last version of Spring Cloud Function as below</p>
  <pre><code>&lt;properties&gt;
      &lt;java.version&gt;8&lt;/java.version&gt;
      &lt;spring-cloud.version&gt;2020.0.1&lt;/spring-cloud.version&gt;
      &lt;aws-lambda-java-core.version&gt;1.2.1&lt;/aws-lambda-java-core.version&gt;
      &lt;aws-lambda-java-events.version&gt;3.7.0&lt;/aws-lambda-java-events.version&gt;
      &lt;aws-java-sdk-s3.version&gt;1.11.948&lt;/aws-java-sdk-s3.version&gt;
      &lt;wrapper.version&gt;1.0.17.RELEASE&lt;/wrapper.version&gt;
  &lt;/properties&gt;
  &lt;dependencies&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-function-context&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-function-adapter-aws&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
          &lt;artifactId&gt;aws-java-sdk-s3&lt;/artifactId&gt;
          &lt;version&gt;${aws-java-sdk-s3.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
          &lt;artifactId&gt;aws-lambda-java-core&lt;/artifactId&gt;
          &lt;version&gt;${aws-lambda-java-core.version}&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
          &lt;artifactId&gt;aws-lambda-java-events&lt;/artifactId&gt;
          &lt;version&gt;${aws-lambda-java-events.version}&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  <p>this is the main class</p>
  <pre><code>public static void main(String[] args) {
      System.out.println(&quot;Application started&quot;);
      SpringApplication.run(Application.class, args);
  }
  
  
  @Bean
  public Function&lt;S3Event, String&gt; extractFileName() {
      return s3Event -&gt; {
          return s3Event.getRecords().get(0).getS3().getBucket().getName();
      };
  }
  </code></pre>
  <p>I'm running the application using AWS SAM</p>
  <pre><code>sam local invoke AwsLambdaS3Local --log-file ./output.log -e event.json
  </code></pre>
  <p>The event.json content is</p>
  <pre><code>{&quot;Records&quot;:[{&quot;eventVersion&quot;:&quot;2.0&quot;,&quot;eventTime&quot;:&quot;1970-01-01T00:00:00.000Z&quot;,&quot;requestParameters&quot;:{&quot;sourceIPAddress&quot;:&quot;127.0.0.1&quot;},&quot;s3&quot;:{&quot;configurationId&quot;:&quot;testConfigRule&quot;,&quot;object&quot;:{&quot;eTag&quot;:&quot;0123456789abcdef0123456789abcdef&quot;,&quot;sequencer&quot;:&quot;0A1B2C3D4E5F678901&quot;,&quot;key&quot;:&quot;test.txt&quot;,&quot;size&quot;:1024},&quot;bucket&quot;:{&quot;arn&quot;:&quot;arn:aws:s3:::demo_bucket&quot;,&quot;name&quot;:&quot;demo_bucket&quot;,&quot;ownerIdentity&quot;:{&quot;principalId&quot;:&quot;EXAMPLE&quot;}},&quot;s3SchemaVersion&quot;:&quot;1.0&quot;},&quot;responseElements&quot;:{&quot;x-amz-id-2&quot;:&quot;EXAMPLE123\/5678abcdefghijklambdaisawesome\/mnopqrstuvwxyzABCDEFGH&quot;,&quot;x-amz-request-id&quot;:&quot;EXAMPLE123456789&quot;},&quot;awsRegion&quot;:&quot;us-east-1&quot;,&quot;eventName&quot;:&quot;ObjectCreated:Put&quot;,&quot;userIdentity&quot;:{&quot;principalId&quot;:&quot;EXAMPLE&quot;},&quot;eventSource&quot;:&quot;aws:s3&quot;}]}
  </code></pre>
  <p>When the application starts, I see the below error</p>
  <pre><code>Caused by: java.lang.IllegalArgumentException: Failed to convert input: GenericMessage [payload=byte[676], headers={date=Fri, 05 Feb 2021 12:59:47 GMT, content-length=676, lambda-runtime-aws-request-id=3a84db79-8fc8-44e3-b223-63d20008cf8c, id=5bde8b80-a881-4c4d-222b-8d0a46c0cb55, contentType=application/json, lambda-runtime-deadline-ms=3225038924621, timestamp=1612529988064}] to class com.amazonaws.services.lambda.runtime.events.S3Event
  </code></pre>
  <p>Any idea?
  Do you have a sample of Spring Cloud Function 2020.0.1 working?</p>
  <p>Thank you</p>