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 '<'
I’ve tried changing the content-type to text/javascript and application/javascript but then it just displays the literal html in the browser