had to wrap our lambdas in a logging library ... and this all worked nicely at the bottom of the lambda file
;; exports
(p/let [wrapped-handler (log/lambda-wrapper handler)]
(clj->js {:handler wrapped-handler}))
It's logical but I'd only ever seen it hard-coded so wanted to share in case it's a useful 'aw, yeah' moment for anyone else(ns acme.log
(:require ["@honeybadger-io/js$default" :as Honeybadger]
[acme.config :as config]
[promesa.core :as p]))
(defn lambda-wrapper
[handler]
(p/let [opts (config/->honeybadger-opts)]
(.configure Honeybadger (clj->js opts))
(.lambdaHandler Honeybadger handler)))
The call to config looks up some stuff in AWS secrets .... so all of this can happen during the Lambda ns loading 🙂