2

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))
5
  • 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. Commented Mar 8, 2019 at 22:41
  • I have updated my question with the macroexpand. Commented Mar 9, 2019 at 1:58
  • 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. Commented Mar 9, 2019 at 2:18
  • Oh, it requires 2 in params. That is why those nil was there. Thank you. Commented Mar 9, 2019 at 3:35
  • I'm glad you figured it out. If you can though, please post a quick answer explaining what the problem was. Commented Mar 9, 2019 at 4:19

1 Answer 1

1

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"))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.