Hello. I’m trying to add an ataraxy router to my existing Duct project. I’ve successfully used this same setup before but this time around I’m getting an Ataraxy validation error that’s really stumping me.
Evaluation error at ataraxy.core/parse (core.clj:98). AssertionError Assert failed: (valid? routes)
I can’t figure out why my routes are failing the spec. Can anyone spot the problem? I’ve simplified all the way back to duplicating the Ataraxy core tests:
(require '[clojure.spec.alpha :as s])
(require '[ataraxy.core :as ataraxy])
(s/explain ::ataraxy/routing-table-with-meta {"/foo" [:bar]})
; nil
; {"/foo" [:bar]} - failed: (or (nil? %) (sequential? %)) in: [0] at: [:value :unordered] spec: :ataraxy.core/routing-table
; {"/foo" [:bar]} - failed: list? in: [0] at: [:value :ordered] spec: :ataraxy.core/routing-table
What do your routes look like? Just {"/foo" [:bar]}
or something more complicated?
My actual route is very simple.
:duct.module/ataraxy {"/" [:index]}
That should be fine. And you have a handler associated with the index route?
Yes. Here’s the pared down system.
{:duct.core/project-ns ticean.clara
:duct.core/environment :production
:duct.module/ataraxy {"/" [:index]}
:ticean.clara.handler/index
{:logger #ig/ref :duct.logger/timbre
:engine #ig/ref :ticean.clara/engine}}
When I remove the ataraxy part the handler is initialized correctly.
At least I think it is. 🙂 I can see the handler fn on the system key.
Have you tried restarting the REPL and hitting lein clean
? Potentially there's something left in memory that's causing issues.
I have restarted. I’ll try a clean.
Hmm… Same problem. I’m using deps.edn
and I don’t have a compiled target dir. I cleared my .cpcache
. Even deleted ataraxy
and duct/module.ataraxy
from my .m2
and saw that they re-downloaded.
Curious. I just created a blank project to test, and it works fine there. What version of Duct and module.ataraxy are you using?
:deps {duct/core {:mvn/version "0.6.2"}
duct/logger {:mvn/version "0.2.1"}
duct/logger.timbre {:mvn/version "0.4.1"}
duct/module.ataraxy {:mvn/version "0.2.0"}
duct/module.logging {:mvn/version "0.3.1"}
duct/module.web {:mvn/version "0.6.4"}
instaparse {:mvn/version "1.4.9"}
org.clojure/clojure {:mvn/version "1.10.0-alpha8"}
com.cerner/clara-rules {:mvn/version "0.18.0"}}
It could be the clojure alpha version. I’ll roll that back.
That rings a bell...
Ah, yes, there was a fix in Ataraxy recently about 1.10 compatibility.
Try adding: ataraxy {:mvn/version "0.4.2"}
to your deps
Confirmed. 1.10.0-alpha8 was the problem.
Thanks I’ll update ataraxy now and test that.
It’s published? Failing to retrieve it. Could not find artifact duct:module.ataraxy:jar:0.4.2 in central
I suppose I could try these nifty new Github deps if not. 🙂
Not the duct/module.ataraxy library
ataraxy {:mvn/version "0.4.2"}
Add a dependency to Ataraxy to override the version pulled in by the module.
🙏 oh, I see. I didn’t read closely enough.
Yes. That’s working in alpha Clojure now. Thank you!
np