Ions on production topology deploy


#1

Hi,

I’m testing out the production topology. On code deploy I get some unexpected errors.

java.io.IOException: Premature EOS, presumed disconnect
java.net.ConnectException: Connection refused

Not doing anything fancy. I have the API gateway that is linked to a ions lambda.

  1. Refresh a few times in the browser to make sure the lamda has an worm instance
  2. Push the code
  3. Deploy the code
  4. Refresh the aws lamda api gateway endpoint while the deploy is running

I get a few of those errors intermittently until the deploy finishes.

My code is just ions related:

(ns datomic.ion.starter
  (:require
   [clojure.data.json :as json]
   [clojure.edn :as edn]
   [clojure.java.io :as io]
   [clojure.pprint :as pp]
   [datomic.client.api :as d]
   [datomic.ion.lambda.api-gateway :as apigw]))
   
   
(defn read-edn
  [input-stream]
  (some-> input-stream io/reader (java.io.PushbackReader.) edn/read))

(defn web-endpoint*
  "Lambda ion that returns sample database items matching type."
  [{:keys [headers body]}]
  (let [type (some-> body read-edn)]
    {:status  200
     :headers {"Content-Type" "text/plain"}
     :body    "prod test... abcd ?"}))

(def web-endpoint
  "API Gateway web service ion for items-by-type"
  (apigw/ionize web-endpoint*))
  
  
;; ions-config.edn
{:allow [;;; web applications
         datomic.ion.starter/web-endpoint]            
 :lambdas {        
           :web-endpoint
           {:fn datomic.ion.starter/web-endpoint
            :integration :api-gateway/proxy
            :description "web app that returns info about items with a particular type"}}
 :app-name "prod"}

Not really sure how to better debug this. My best guess would be that the lambda is calling the servers even though code-deploy is doing it’s thing, and has a bit of lag until it figures it out.

Can get my app to retry API calls, but looks like SSR is not an option for now.

Is there any fix for this or will this be fixed once you add the functionality for calling the server without the use of lambdas ?