duct

2018-10-24T18:58:52.000100Z

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

2018-10-24T19:00:34.000100Z

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

2018-10-24T19:01:34.000100Z

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

2018-10-24T19:02:15.000100Z

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

2018-10-24T19:03:15.000100Z

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

2018-10-24T19:03:41.000100Z

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

2018-10-24T19:04:19.000100Z

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

2018-10-24T19:04:28.000100Z

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

2018-10-24T19:04:55.000100Z

I have restarted. I’ll try a clean.

2018-10-24T19:12:06.000100Z

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.

2018-10-24T19:12:59.000100Z

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

2018-10-24T19:13:56.000100Z

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

2018-10-24T19:14:12.000100Z

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

2018-10-24T19:14:29.000100Z

That rings a bell...

2018-10-24T19:15:14.000100Z

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

2018-10-24T19:15:42.000100Z

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

2018-10-24T19:16:45.000100Z

Confirmed. 1.10.0-alpha8 was the problem.

2018-10-24T19:16:55.000100Z

Thanks I’ll update ataraxy now and test that.

2018-10-24T19:19:42.000100Z

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

2018-10-24T19:20:22.000100Z

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

2018-10-24T19:20:39.000100Z

Not the duct/module.ataraxy library

2018-10-24T19:20:51.000100Z

ataraxy {:mvn/version "0.4.2"}

2018-10-24T19:21:10.000100Z

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

2018-10-24T19:21:41.000100Z

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

2018-10-24T19:23:42.000100Z

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

2018-10-24T19:26:40.000100Z

np