Fork me on GitHub

Heyo, fellas! 👋


I'm new to the tech, been trying to run locally

[{([:customer/id 123] {:pathom/context {:customer/first-name "Foo" :customer/last-name "Bar"}})
and it fails with
1. Unhandled java.lang.IllegalArgumentException
   Key must be integer  294  clojure.lang.APersistentVector/invoke
                      REPL:   96  app.server-components.pathom/eval48368
                      REPL:   95  app.server-components.pathom/eval48368
    7177  clojure.lang.Compiler/eval
    7132  clojure.lang.Compiler/eval
                  core.clj: 3214  clojure.core/eval
                  core.clj: 3210  clojure.core/eval
    interruptible_eval.clj:   91  nrepl.middleware.interruptible-eval/evaluate/fn
                  main.clj:  437  clojure.main/repl/read-eval-print/fn
                  main.clj:  437  clojure.main/repl/read-eval-print
                  main.clj:  458  clojure.main/repl/fn
                  main.clj:  458  clojure.main/repl
                  main.clj:  368  clojure.main/repl
      1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   84  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   56  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  155  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
           22  clojure.lang.AFn/run
               session.clj:  190  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  189  nrepl.middleware.session/session-exec/main-loop
           22  clojure.lang.AFn/run
       830  java.lang.Thread/run


Bit more of context:

(defn build-parser [db-connection]
  (let [real-parser (p/parallel-parser
                      {::p/mutate  pc/mutate-async
                       ::p/env     {::p/reader               [p/map-reader pc/parallel-reader
                                                              pc/open-ident-reader p/env-placeholder-reader]
                                    ::p/placeholder-prefixes #{">"}}
                       ::p/plugins [(pc/connect-plugin {::pc/register all-resolvers})
                                    (p/env-wrap-plugin (fn [env]
                                                         ;; Here is where you can dynamically add things to the resolver/mutation
                                                         ;; environment, like the server config, database connections, etc.
                                                         (assoc env
                                                                :db (d/db db-connection)
                                                                :conn db-connection
                                                                :config config)))
                                    (preprocess-parser-plugin log-requests)
                                    (p/post-process-parser-plugin p/elide-not-found)
        ;; NOTE: Add -Dtrace to the server JVM to enable Fulcro Inspect query performance traces to the network tab.
        ;; Understand that this makes the network responses much larger and should not be used in production.
        trace?      (not (nil? (System/getProperty "trace")))]
    (fn wrapped-parser [env tx]
      (async/<!! (real-parser env (if trace?
                                    (conj tx :com.wsscode.pathom/trace)

((build-parser (client/get-conn))
 {} [{([:customer/id 123] {:pathom/context {:customer/first-name "Foo" :customer/last-name "Bar"}})
com.wsscode/pathom {:mvn/version "2.2.31"}


Sorry if it had been asked, googled something close in clojurians slack log, but the site appears down for me


The "Bit more of context" part isn't necessary. Clojure vectors can be called as functions. You can call vectors with indices, and get back elements at those indices. For example, ([:a :b] 0) evaluates to :a and ([:a :b] 1) evaluates to :b. In your case, you're trying to call [:customer/id 123] like a function, but with something that's not an int (like indices). So, you're getting the IllegalArgumentException


You can quote the list to get around this. For example, try ([:a :b] 100) and '([:a :b] 100) in your REPL.


> Clojure vectors can be called as functions being my third year in production I learn that only now haha 😅 thank ya