This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-28
Channels
- # announcements (11)
- # aws (2)
- # babashka (35)
- # beginners (173)
- # calva (3)
- # chlorine-clover (2)
- # cider (17)
- # clara (2)
- # clj-kondo (28)
- # cljs-dev (11)
- # cljsrn (53)
- # clojure (178)
- # clojure-argentina (1)
- # clojure-europe (12)
- # clojure-germany (5)
- # clojure-italy (4)
- # clojure-nl (5)
- # clojure-spec (25)
- # clojure-uk (88)
- # clojurescript (109)
- # conjure (34)
- # cursive (2)
- # data-science (35)
- # datomic (15)
- # emacs (6)
- # events (1)
- # fulcro (28)
- # graphql (15)
- # helix (21)
- # hoplon (7)
- # jobs (4)
- # jobs-discuss (1)
- # joker (15)
- # lambdaisland (1)
- # lein-figwheel (4)
- # local-first-clojure (1)
- # malli (8)
- # meander (17)
- # off-topic (33)
- # parinfer (2)
- # rdf (16)
- # re-frame (3)
- # reagent (21)
- # reitit (14)
- # remote-jobs (5)
- # ring (8)
- # rum (1)
- # shadow-cljs (184)
- # sql (2)
- # testing (1)
- # tools-deps (23)
So i have a reagent app in an S3 and am trying to hit it with a Lambda
(defn handle-event [event]
(let [s3 (aws/client {:api :s3})
file (aws/invoke s3 {:op :GetObject :request {:Bucket "my-bucket" :Key "public/index.html"}})]
(pprint event)
{
"statusCode" 200,
"statusDescription" "200 OK"
"isBase64Encoded" false
"headers" {
"Content-Type" "text/html"}
"body" (slurp (:Body file))}))
(defn key->keyword [key-string]
(-> key-string
(st/replace #"([a-z])([A-Z])" "$1-$2")
(st/replace #"([A-Z]+)([A-Z])" "$1-$2")
(st/lower-case)
(keyword)))
(defn -handleRequest [this is os context]
(let [w (io/writer os)]
(-> (json/read (io/reader is) :key-fn key->keyword)
(handle-event)
(json/write w))
(.flush w)))
i originally just had “index.html” in the handle event
function but was getting 502
no that i have “public/index.html” it hits but it comes up blank and the console says
Uncaught SyntaxError: Unexpected token '<'