2
votes

I am using shadowcljs and I am trying to create a mutation on the server using code based of the example code. I have a really small mutation that always throws this error. Why is that?

[jchat.server-components.pathom-wrappers :refer [defmutation defresolver]]

(defmutation reset-users-db
             "Removes all users"
             []
             {::pc/output [:message]}
             {:message "ok"})

Syntax error macroexpanding clojure.core/let at (user.clj:47:1). nil - failed: simple-symbol? at: [:bindings :form :local-symbol] spec: :clojure.core.specs.alpha/local-name nil - failed: vector? at: [:bindings :form :seq-destructure] spec: :clojure.core.specs.alpha/seq-binding-form nil - failed: map? at: [:bindings :form :map-destructure] spec: :clojure.core.specs.alpha/map-bindings nil - failed: map? at: [:bindings :form :map-destructure] spec: :clojure.core.specs.alpha/map-special-binding

Row 47 is the defmutation starting row.

With macroexpand:

(macroexpand '(defmutation reset-users-db
                           "Removes all users"
                           []
                           {::pc/output [:message]}
                           {:message "ok"}))
=>
(do
 (com.wsscode.pathom.connect/defmutation
  reset-users-db
  [env__26870__auto__ params__26871__auto__]
  #:com.wsscode.pathom.connect{:output [:message]}
  (clojure.core/let [nil env__26870__auto__ nil params__26871__auto__] {:message "ok"}))
 (jchat.server-components.pathom-wrappers/register! reset-users-db))
1
Try wrapping it in a call to macroexpand to see if it's expanding to something weird. I've never heard of that macro before. - Carcigenicate
I have updated my question with the macroexpand. - jt123
Likely (clojure.core/let [nil env__26870.... (let [nil ""]) causes <CompilerException java.lang.Exception: Unsupported binding form: , compiling:(Clojure REPL:2:1)> in 1.7.0. I don't know why nil is there in the expansion, but that's your problem. - Carcigenicate
Oh, it requires 2 in params. That is why those nil was there. Thank you. - jt123
I'm glad you figured it out. If you can though, please post a quick answer explaining what the problem was. - Carcigenicate

1 Answers

1
votes

Thanks to Carcigenicate helping me debug and understand the debuigging we found that the mutation required 2 in params.

Such as:

(defmutation reset-users-db
             "Removes all users"
             [env params]
             {::pc/output [:message]}
             (println "test"))