Fork me on GitHub
#holy-lambda
<
2022-12-15
>
viesti18:12:26

A thought, but Snapstart makes https://github.com/FieryCod/holy-lambda-ring-adapter even more important, since just more avenues to use JVM/Clojure with Lamba + API Gateway :) @karol.wojcik

Karol Wójcik18:12:13

Yes, just we need to restore some code to use plain java11 instead of custom zipped layer :)

viesti18:12:04

haa, maybe I missed that code, have been happily using ring<->hl-middleware with plain jvm11 runtime, with glue like this

(gen-class
  :name "..."
  :implements [com.amazonaws.services.lambda.runtime.RequestStreamHandler])

(def handler
  (hlra/ring<->hl-middleware (-> core/handler
                                 (mw/some-mw)
                                 ...
                                 (mw/another-mw))))

#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
(defn -handleRequest [_this in out ctx]
  (let [event (json/read-value in json/keyword-keys-object-mapper)
        response (handler {:event event
                           :ctx ctx})]
    (json/write-value out response)))
(the thing under :ctx not same as in HL proper, but haven't needed ctx stuff yet :)) I use that sometimes to deploy a jvm version of a lambda (just change artifact & runtime in Terraform with a boolean var), when I don't have the patience to wait for native-image compilation to finish 🙂