BUT THERE’S AN ERROR: : clojure.lang.ExceptionInfo: java.lang.ClassCastException in Interceptor :workflow-instances-download - class clojure.lang.MapEntry cannot be cast to class clojure.lang.IPersistentMap (clojure.lang.MapEntry and clojure.lang.IPersistentMap are in unnamed module of loader 'app')
(defn download-chatrooms
"Export chatrooms of the workflow template in CSV format"
[db-spec org-id uid template-id & {:keys [order-by filter-by report-id]}]
And call it directly in the REPL (download-chatrooms (:myapp/db integrant.repl.state/system) 1 "L0QGp8J3P0fFNq7eGeR7Tl61UuL2" 4 :report-id 3)
I’m passing only report-id and ignore order-by and filter-by, then I get this ORDR_BY FILTR_BY RPTID nil nil 3 along with the data
But for the same function if I have another method call it like this:
The send a request http://localhost:3593/workflow/4/chatroom/download?page=1&sort=seqNo:desc&reportId=3 Then I get same like above ORDR_BY FILTR_BY RPTID nil nil 3 But doesn’t show the data and says this
ERROR [myapp.service:202] - : clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException in Interceptor :workflow-instances-download - Failed to fetch the report {:execution-id 1, :stage :enter, :interceptor :workflow-instances-download, :exception-type :java.lang.IllegalArgumentException, :exception #error {
:cause "Failed to fetch the report"
:via
[{:type java.lang.IllegalArgumentException
:message "Failed to fetch the report"
:at [myapp.db.process$get_report invokeStatic "process.clj" 677]}]
They are positional before the &. They are positional after& as well if you use sequence destructuring & [foo bar]. They are named if you use map destructuring & {:keys [foo bar]}.
In both cases, the arguments after & are optional.
Your two calls – via the REPL and via the “req method” – are different. In the REPL you pass :report-id 3 but in the other code you pass :report-id {:report-id 3}. In the first case, report-id is bound to 3 in the call. In the second case, report-id is bound to a hash map (which is why you get the illegal argument exception): {:report-id 3}