title: Null pointer exception calling an aws lambda function using clojure?
body: <p>I am trying to put a json object into an s3 bucket using the Amazonica client in clojure. I am getting a NullPointerException when I call my lambda function. Here is my code:</p>
  <pre><code>(ns clojurehandler.s3_clojure_handler
    (:gen-class
     :name &quot;clojurehandler.S3ClojureHandler&quot;
     :implements [com.amazonaws.services.lambda.runtime.RequestStreamHandler])
    (:require
              [clojure.java.io :as io]
              [clojure.data.json :as json]
              [amazonica.aws.s3 :as s3]))
  
  (defn handle-event [event]
    (s3/put-object
              :bucket-name &quot;bucket name&quot;
              :key &quot;original&quot;
              :metadata {:server-side-encryption &quot;AES256&quot;}
              :file event)
    {:status 200})
  
  (defn -handleRequest [this is os context]
    (handle-event is))
  </code></pre>
  <p>And here is the stack trace:</p>
  <pre><code>{
    &quot;errorMessage&quot;: &quot;java.lang.NullPointerException&quot;,
    &quot;errorType&quot;: &quot;java.lang.NullPointerException&quot;,
    &quot;stackTrace&quot;: [
      &quot;com.amazonaws.internal.SdkFilterInputStream.markSupported(SdkFilterInputStream.java:108)&quot;,
      &quot;com.amazonaws.http.AmazonHttpClient.beforeRequest(AmazonHttpClient.java:471)&quot;,
      &quot;com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:356)&quot;,
      &quot;com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:329)&quot;,
      &quot;com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:308)&quot;,
      &quot;com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3659)&quot;,
      &quot;com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1422)&quot;,
      &quot;java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&quot;,
      &quot;java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)&quot;,
      &quot;java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)&quot;,
      &quot;java.base/java.lang.reflect.Method.invoke(Unknown Source)&quot;,
      &quot;java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&quot;,
      &quot;java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)&quot;,
      &quot;java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)&quot;,
      &quot;java.base/java.lang.reflect.Method.invoke(Unknown Source)&quot;,
      &quot;clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)&quot;,
      &quot;clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)&quot;,
      &quot;amazonica.core$fn_call$fn__457.invoke(core.clj:816)&quot;,
      &quot;amazonica.core$intern_function$fn__485.doInvoke(core.clj:887)&quot;,
      &quot;clojure.lang.RestFn.invoke(RestFn.java:619)&quot;,
      &quot;clojurehandler.s3_clojure_handler$handle_event.invokeStatic(s3_clojure_handler.clj:16)&quot;,
      &quot;clojurehandler.s3_clojure_handler$handle_event.invoke(s3_clojure_handler.clj:14)&quot;,
      &quot;clojurehandler.s3_clojure_handler$_handleRequest.invokeStatic(s3_clojure_handler.clj:32)&quot;,
      &quot;clojurehandler.s3_clojure_handler$_handleRequest.invoke(s3_clojure_handler.clj:31)&quot;,
      &quot;clojurehandler.S3ClojureHandler.handleRequest(Unknown Source)&quot;
    ]
  }
  </code></pre>
  <p>Thanks</p>