aws-lambda

hawari 2017-11-29T09:17:23.000078Z

Has anyone ever deployed a compojure-api apps to AWS Lambda? I've found this library: https://github.com/mhjort/ring-apigw-lambda-proxy From what I can digest, what this library do is help creating the class which implements an interface that AWS requires (with the help of this another library: https://github.com/uswitch/lambada), and add a middleware which are able to wrap existing compojure routes in order to "transform" an event into ring request. But I'm having problem, AWS says that the class that was generated by library was not found. Even though I can clarify that the .class file exists in the built jar file. What did I possibly miss? Basically my current handler file goes exactly as the library give example of:

(ns my-namespace)

(defapi app
  ... (my route goes here))

(def handler (wrap-apigw-lambda-proxy
               (wrap-json-response
                 (wrap-json-params
                   (wrap-params
                     (wrap-keyword-params
                       app))))))

(deflambdafn example.LambdaFn [is os ctx]
  (with-open [writer (io/writer os)]
    (let [request (parse-stream (io/reader is :encoding "UTF-8") true)]
      (generate-stream (handler request) writer))))
And in the AWS console I set the my-namespace.LambdaFn as the class

liammccombes 2017-11-29T12:02:55.000467Z

maybe try deflambdafn my-namespace.LambdaFn instead of deflambdafn example.LambdaFn?

👌 1