Fork me on GitHub

Finally working on the big upgrade for Datomic Cloud and when going to version 939-9127 I'm getting a 502 Bad Gateway response when calling the newly created IonApiGatewayEndpoint . Any suggestions?

Jarrod Taylor (Clojure team)02:02:25

Can you provide more detail on what has been done with regard to upgrading? How are you calling the ion endpoint and have you deployed an app that you expect to be able to hit?


• Upgrade Process going from 704-8957 -> 939-9127 ◦ Upgraded Storage succesfully ◦ Failed to upgrade compute nodes in CF(rollback) ◦ Deleted Compute nodes ◦ Created new nodes successfully with 939-9127 template ◦ Updated deps.edn w/ ◦ Able to get data locally with the new ClientApiGatewayEndpoint ◦ Removed (apigw/ionize app) function ◦ App is using Reitit similar to ◦ Edited ion-config.edn similar to ◦ Push/deploy successfully ◦ Grabbed the IonApiGatewayEndpoint and it returns a 502 Bad Gateway response when calling from the browser, with curl, and with Postman.


Wondering if there is more configuration needed in API-Gateway. I see, in the terraform scripts the routes were configured someway.


Used your example app @U0508JRJC without the auth endpoints and I'm still getting the error after a successful deploy. Found this But not sure how to debug.

Jarrod Taylor (Clojure team)20:02:24

The terraform script is only modifying the api-gateway routes to accommodate the public/private routing in the example this isn’t strictly required for any application as a default. The default route created by the cloud formation script will proxy all requests to your app and in your case the reitit router. I would suspect the application as the source of the problem before turning to the LB. A newly created stack will return a 502 if there isn’t an app deployed yet. Can you run the application locally? Are you trying to hit the root ion endpoint or a deeper path in your router?


The app runs locally. I've tried both the base endpoint and the deeper paths. Changes to the app after upgrade: • Removed (apigw/ionize app) function • Removed the :integration :api-gateway/proxy lambda from the ion-config.edn • Edited ion-config.edn to

{:allow       [blvd.blvd-app-api.router/app]

 :http-direct {:handler-fn blvd.blvd-app-api.router/app}

 :app-name    "our-app-name"}


;;; Public routes
(defn ping-response [_]
  {:status 200
   :body   {:message "Pong'ing back"}})

(def public-routes
   ["/ping" {:name ::ping
             :get  {:handler ping-response}}]])

(def app
      ["/api/v1" [public-routes]]
      {:data      {:muuntaja   m/instance
                   :middleware [mw/options-mw

Jarrod Taylor (Clojure team)22:02:43

That all appears correct, but I assume there is more to the application? If you want to / can share the actual application code I can poke it further <mailto:[email protected]|[email protected]> or JarrodCTaylor on github. If that is not an option you can enable logging in the api gateway which I don’t expect will report much other than that there was a 502 response issued, but it is something I always do when debugging.


Thanks, I'll keep poking at it tonight and if I don't figure it out will shoot you an e-mail tomorrow. One last question here, you said we'd get 502 if the app hasn't been deployed. Is there a way to check in the console if it was deployed other than the successful response and in the Step Functions? In the last version the lambda would be created for the proxy, anything similar for http-direct?


@U0508JRJC Any answer to that last question. I was able to clone your repo and deploy it to our system and hit the endpoint successfully. But when I deploy your app from our #polylith repo it doesn't connect. We've changed our deps to match yours. I've had no issue deploying from Polylith before with the ionize functions and they say in their they've been able to deploy on the latest version. Lambas also are built but the Ions endpoint isn't callable. Just wondering if the app is being deployed or not and wondering where I can check.

Jarrod Taylor (Clojure team)02:02:25

I will get a replay back to you tomorrow.

gratitude-thank-you 1