I have the following routes:
{:duct.profile/base {:duct.core/project-ns logout
:duct.router/ataraxy
{:routes {"/v1/logout" [:logout]}
:handlers {:logout #ig/ref :my-app/logout}}
:duct.logger/clojure {}}
:duct.profile/dev #duct/include "dev"
:duct.profile/local #duct/include "local"
:duct.profile/prod {}
:duct.module.web/api {}
:my-app/logout {:env/deployment-env #duct/env "DEPLOYMENT_ENV"}}
and in ns my-app
the following init-key:
(defmethod ig/init-key :my-app/logout
[_ {:env/keys [deployment-env] :as _opts}]
(log/info ::logout.init {:deployment-env deployment-env})
(fn [_handler]
(fn [request]
(log/debug ::logout {:request request})
(create-logout-response deployment-env))))
When I start the system with lein repl (dev) (go)
I get:
Execution error (IllegalArgumentException) at integrant.core/load-namespaces (core.cljc:182).
Don't know how to create ISeq from: my-app.logout$eval18600$fn__18602$fn__18604$fn__18605
Any idea why?
I think it should be :routes {"/v1/logout" [:my-app/logout]}
. And remove the :handlers
key
Haha
Same result
Oh
:my-app/logout
is outside of the base profile
Ah moving it to the base profile fixed the problem
Thanks! 😄
👍
@weavejester This PR is still open, regarding adding a specific error message for when a regular key is added outside of the base profile https://github.com/duct-framework/core/pull/32 Maybe we can get this merged to prevent this in the future?
Error when calling the endpoint is: java.lang.ClassCastException my-app.logout$eval25212$fn__25214$fn__25216$fn__25217 cannot be cast to clojure.lang.Associative
Any suggestions?
create-logout-response
:
(defn- create-logout-response [deployment-env]
{:status see-other-status-code
:headers {"location" (create-keycloak-logout-url deployment-env)
"set-cookie" (create-expired-keycloak-cookies deployment-env)}})
Your handler seems to have two functions instead of 1?
Just returns a map
I meant this: The (fn [_handler]
should be removed
Ahhh
Works. Thanks!!! 😆
😄