Fork me on GitHub
#pathom
<
2019-11-07
>
wilkerlucio01:11:07

hello @dansudol, are you using the pathom-datomic package, or doing the integration with regular resolver?

daniel.spaniel01:11:23

honestly not 100% sure Wilker ..

daniel.spaniel01:11:42

but I found the issue was with a particular join query

daniel.spaniel01:11:59

it seems to work fine in production but not locally

daniel.spaniel01:11:33

it is truely bizzarre and i think you might have more insight than i

wilkerlucio02:11:53

can you show the query that you see trouble? did you tried to debug using the pathom trace?

cjmurphy04:11:35

@dansudol With Pathom I have seen execution on the server just halting, with no error being reported. For example I recently had this problem when server code did a select-keys with the 2nd arg being a keyword rather than a vector as it is supposed to be. I only got to see the error by calling the code directly, outside of Pathom. The issue is that core.async errors are not reported to the thread/REPL you are running in. If Pathom could be run without using core.async I believe this error message (for bad select-keys call) would have been seen in the REPL. I think that this kind of problem will be fixed when spec becomes a part of Clojure, as ordinary functions will then be checked. At the moment I can see that guardrails/Ghostwheel issues are reported by expound - so spec works with Pathom. Another thing is that just regular asserts will also not show up, although you can get around this by having your own assert macro that writes the message and stack trace to a file before throwing the AssertionError.

wilkerlucio14:11:54

for debugging this case of thing, I suggest you try to use the serial parser, I'm actually starting to think the serial is a better general recommendation than the parallel, its simpler to understand and debug, and I believe most people are not taking that much out of the parallel (you need to have a fair amount of parallelism opportunity to get significant gains with that)

wilkerlucio15:11:56

at Nubank we have extra setup to get errors reported in a more systematic way, you can use the ::p/process-error to setup a custom error handler, that works with both serial and parallel, from that I suggest you can log the errors in some source you can lookup later

daniel.spaniel16:11:55

good suggest about logging errors chris and i am trying serial parser now

daniel.spaniel16:11:10

also I have set up what I thought was error reporting this way

daniel.spaniel16:11:12

::p/plugins    [(pc/connect-plugin {::pc/register (vec (vals @pathom-registry))})
                                       (p/env-wrap-plugin
                                         (fn [{:keys [conn] :as env}]
                                           (merge env {:config
                                                       config
                                                       ::p/process-error
                                                       (fn [_ err]
                                                         ; print stack trace
                                                         (.printStackTrace err)

                                                         ; return error str
                                                         (p/error-str err))})))
                                       (preprocess-parser-plugin log-requests)
                                       (p/post-process-parser-plugin p/elide-not-found)


                                       ;p/request-cache-plugin
                                       p/error-handler-plugin
                                       p/trace-plugin]

daniel.spaniel16:11:36

but it is not throwing out any errors

daniel.spaniel16:11:10

actually when switching to serial parser i got an error

daniel.spaniel16:11:12

java.lang.IllegalArgumentException: No implementation of method: :take! of protocol: #'clojure.core.async.impl.protocols/ReadPort found for class: clojure.lang.PersistentArrayMap

daniel.spaniel16:11:19

so i switching back to parralel

wilkerlucio16:11:45

@dansudol about the switch, you also need to switch the reader, instead of pc/parallel-reader you should use pc/reader2

wilkerlucio16:11:52

also the mutation fn must be changed, from pc/mutate-async to pc/mutate

daniel.spaniel17:11:34

Wow .. @U066U8JQJ thank goodness you reminded me about those 2 methods ( even without looking at my setup ) that is what I had

daniel.spaniel17:11:55

I also had this

daniel.spaniel17:11:58

(fn wrapped-parser [env tx]
      (async/<!! (real-parser env (if trace?
                                    (conj tx :com.wsscode.pathom/trace)
                                    tx))))

wilkerlucio17:11:11

yeah, that needs to change, the serial returns a regular map, simpler stuff 🙂

daniel.spaniel17:11:25

so you can see why it was barfing .. gosh .. amazing .. but your idea helped me out

daniel.spaniel17:11:58

(fn wrapped-parser [env tx]
      (real-parser env (if trace?
                         (conj tx :com.wsscode.pathom/trace)
                         tx)))

daniel.spaniel17:11:08

everything works now .. amazing

wilkerlucio17:11:23

glad to hear 🙂