Search code examples
herokuclojurecompojure

compojure POST request parameters are empty when app deployed to heroku


My code is very simple:

(def form-test
  "<html><body><form action=\"/\" method=\"POST\"><input type=\"text\" name=\"ss\"/><input type=\"submit\" value=\"submit\"/></form></body></html>")

(defroutes app-routes
  (GET "/" [] form-test)
  (POST "/" req (str "the req: " req))
  (route/resources "/")
  (route/not-found "Not Found"))

(def app
  (handler/site app-routes))

whenever I try my app on my local machine it works fine, I can see the request parameters, but when I deploy the same thing to heroku the request parameters are always empty... what's going on?


Solution

  • OK so I resolved my issue, the problem was the way my program was being executed in Heroku. My Procfile previously:

    web: lein run -m myapp.core
    

    all I did is change it to:

    web: java $JVM_OPTS -jar myapp.jar
    

    basically I had to execute my program as a compiled jar.