Gravity123
Gravity123

Reputation: 1130

Syntax error macroexpanding clojure.core/let

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

Upvotes: 2

Views: 4006

Answers (1)

Gravity123
Gravity123

Reputation: 1130

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"))

Upvotes: 1

Related Questions