Fork me on GitHub
#duct
<
2018-10-24
>
ticean18:10:52

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

weavejester19:10:34

What do your routes look like? Just {"/foo" [:bar]} or something more complicated?

ticean19:10:34

My actual route is very simple. :duct.module/ataraxy {"/" [:index]}

weavejester19:10:15

That should be fine. And you have a handler associated with the index route?

ticean19:10:15

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}}

ticean19:10:41

When I remove the ataraxy part the handler is initialized correctly.

ticean19:10:19

At least I think it is. 🙂 I can see the handler fn on the system key.

weavejester19:10:28

Have you tried restarting the REPL and hitting lein clean? Potentially there's something left in memory that's causing issues.

ticean19:10:55

I have restarted. I’ll try a clean.

ticean19:10:06

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 .m2and saw that they re-downloaded.

weavejester19:10:59

Curious. I just created a blank project to test, and it works fine there. What version of Duct and module.ataraxy are you using?

ticean19:10:56

: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"}}

ticean19:10:12

It could be the clojure alpha version. I’ll roll that back.

weavejester19:10:29

That rings a bell...

weavejester19:10:14

Ah, yes, there was a fix in Ataraxy recently about 1.10 compatibility.

weavejester19:10:42

Try adding: ataraxy {:mvn/version "0.4.2"} to your deps

ticean19:10:45

Confirmed. 1.10.0-alpha8 was the problem.

ticean19:10:55

Thanks I’ll update ataraxy now and test that.

ticean19:10:42

It’s published? Failing to retrieve it. Could not find artifact duct:module.ataraxy:jar:0.4.2 in central

ticean19:10:22

I suppose I could try these nifty new Github deps if not. 🙂

weavejester19:10:39

Not the duct/module.ataraxy library

weavejester19:10:51

ataraxy {:mvn/version "0.4.2"}

weavejester19:10:10

Add a dependency to Ataraxy to override the version pulled in by the module.

ticean19:10:41

🙏 oh, I see. I didn’t read closely enough.

ticean19:10:42

Yes. That’s working in alpha Clojure now. Thank you!