title: How to handle multipart/form-data file uploads using micronaut-function-aws-api-proxy
body: <p>I'm using <code>micronaut</code> <code>1.1.0.RC2</code> and <code>micronaut-function-aws-api-proxy</code> <code>1.1.0.RC3</code> within an AWS API Gateway proxy to a Kotlin Lambda function. The micronaut aws api proxy works fine for all of my API functions except for the file upload route. Class and route definition look something like this:</p>
  
  <pre><code>@Controller("/things/{id}/attachments")
  class AttachmentController {
      @Post(consumes = [MediaType.MULTIPART_FORM_DATA])
      fun post(request: HttpRequest&lt;Any&gt;, id: Int, file: CompletedFileUpload): Attachment? {
          ...
      }
  }
  </code></pre>
  
  <p>Running locally, this works fine. But, when I use it via API Gateway and Lambda, I keep getting the follow error:</p>
  
  <pre><code>ERROR c.a.s.p.AwsProxyExceptionHandler Called exception handler for:
  io.micronaut.web.router.exceptions.UnsatisfiedRouteException: Required argument [CompletedFileUpload file] not specified
  at io.micronaut.web.router.AbstractRouteMatch.execute(AbstractRouteMatch.java:279)
  at io.micronaut.web.router.RouteMatch.execute(RouteMatch.java:122)
  ...
  </code></pre>
  
  <p>Again, if I run the micronaut application locally and hit the API directly (no micronaut AWS proxy), it functions perfectly. But, when I deploy it to AWS, there seems to be an issue with the micronaut aws proxy that doesn't correctly parse out the multipart form-data.</p>
  
  <p>I do have <code>multipart/form-data</code> set as a binary media type on the API Gateway. I have tried using both the <code>CompletedFileUpload</code> type and the <code>StreamingFileUpload</code> type as described in the main micronaut docs (<a href="https://docs.micronaut.io/1.1.0.RC2/guide/index.html" rel="nofollow noreferrer">https://docs.micronaut.io/1.1.0.RC2/guide/index.html</a>) with the same results.</p>
  
  <p>And for what it's worth, I have a different implementation of this same thing using the AWS spark proxy (aws-serverless-java-container-spark) and it functions correctly.</p>
  
  <p>To test, I'm running this curl command:</p>
  
  <pre><code>curl -X POST https://&lt;host&gt;/things/42/attachments -H 'content-type: multipart/form-data' -F file=@/path/to/file.png
  </code></pre>
  
  <p>Has anyone else had any luck with this? Is it just not supported at this point by the micronaut api gateway proxy? Any help is appreciated!</p>