hi guys I'm trying to reproduce some error, but maybe I've been invoke mutations wrong, my example code is in this link https://gist.github.com/matheusfrancisco/09de37256dd94d8935e4d3be64adf7c9 , but
(pco/defresolver ex11 []
{::pco/output [:ex.xico/http]}
{:ex.xico/http (http/post "<https://url.org/1/post>" {:headers {:Content-Type "application/json"}})})
(pco/defmutation mutation-ex3 []
{:ex.xico/cc (http/post "<https://url.org/2/post>" {:headers {:Content-Type "application/json"}})})
(def env1 (->
(pci/register
[ex11
ex12
mutation-ex3])
(psm/with-error-mode ::psm/error-mode-loud)))
;; note in line 41 with psm/with-error-mode if I comment #_(psm/...) this line, the mutation will be work.
;; with this line(41) uncommented the invoke at line 47 return an error, I put in first comment bellow
(:ex.xico/http (psm/smart-map env1))
(p.eql/process env1 [`(mutation-ex3)])
when I had been invoke my mutation i got this error
:data #:com.wsscode.pathom3.attribute{:attribute :async},
:via [{:type clojure.lang.ExceptionInfo,
:message "Can't find a path for :async",
:data #:com.wsscode.pathom3.attribute{:attribute :async},
:at [com.wsscode.pathom3.connect.runner.stats$attribute_error__25438 invokeStatic "stats.cljc" 73]}],
:trace [[com.wsscode.pathom3.connect.runner.stats$attribute_error__25438 invokeStatic "stats.cljc" 73]
but, when I comment the (psm/with-error-mode ::psm/error-mode-loud) my mutations call the clj-http/post.
may I don't know much about pathom, but should I don't use (psm/with-error-mode ..) actived with mudations?I wonder if it's better to use a http client that returns CompletableFutures, like https://github.com/gnarroway/hato
are you getting that error from the smart map call or the p.eql/process call?
at the p.eql/process call.
but the smart map call works? maybe you can't pass the psm/with-error-mode
to an env used for eql calls? It's under the smart map namespace so I think it wouldn't do anything for p.eql
anyway
the smart-map calls works, and if I change my mutation to another resolver it'll be work too.
try making a different env, without psm/with-error-mode
for the p.eql
call
I don't think there's any reason for that to be part of the p.eql
env
I really don't know what is the problem (initial I was thing that pathon was cache the others http calls , but i really don't know hehe
I remove psm/with-error-mode from env and the mutations was called
yeah so psm/with-error-mode
may be incompatible with p.eql
, but does work with mutations
it shouldn't be, the eql runner just ignores the smart map error mode, it has no relationship
@matheusfrancisco001 I can't follow your line numbers on this example
can you send a minimal reproduction of the problem? that's the best way to bring some issue
i'm trying to reproduce this with a mock server http, but doesn't throw the error..
I try to create a minimal example here https://gist.github.com/matheusfrancisco/09de37256dd94d8935e4d3be64adf7c9
@wilkerlucio I follow the stack trace into pathom3 namespaces and in this function
should have this key :com.wsscode.pathom3.attribute/attribute
but it doesn't there
(defn sm-env-get
"Get a property from a smart map.
First it checks if the property is available in the cache-tree, if not it triggers
the connect engine to lookup for the property. After the lookup is triggered the
cache-tree will be updated in place, note this has a mutable effect in this data,
but this change is consistent.
Repeated lookups will use the cache-tree and should be as fast as reading from a
regular Clojure map."
([env k] (sm-env-get env k nil))
([{::p.ent/keys [entity-tree*] :as env} k default-value]
(let [ent-tree @entity-tree*]
(if-let [x (find ent-tree k)]
(wrap-smart-map env (val x))
(let [ast {:type :root
:children [{:type :prop, :dispatch-key k, :key k}]}
stats (-> (pcr/run-graph! env ast entity-tree*) meta ::pcr/run-stats)]
(when-let [error (and (refs/kw-identical? (get env ::error-mode) ::error-mode-loud)
(-> (p.eql/process (pcrs/run-stats-env stats)
{:com.wsscode.pathom3.attribute/attribute k}
[::pcrs/attribute-error])
::pcrs/attribute-error
::pcr/node-error))]
(throw error))
(wrap-smart-map env (get @entity-tree* k default-value)))))))
it means something to you, that helps me to explorate this problem?
in this part of code
(-> (p.eql/process (pcrs/run-stats-env stats)
{:com.wsscode.pathom3.attribute/attribute k}
[::pcrs/attribute-error])
::pcrs/attribute-error
::pcr/node-error))
@matheusfrancisco001 I just copied and ran your minimal example, but I can't see any issues
(p.eql/process env1 [`(mutation-ex3)])
=>
#:com.wsscode.pathom3.demos.buzzlabs{mutation-ex3 #:ex.xico{:cc "<https://url2.org/post>"}}
(:ex.xico/http (psm/smart-map env1))
=> "<https://httpbin.org/post>"
what is wrong? how can I see it in my end?
ys, my example doesn't throw exceptions, because I can't reproduce it my self yet. I trying to, I really don't know why this happened
Hey I’m playing around with pathom-viz (2021.2.1) via connect-env
(2021.01.25), request trace is checked, and everything else looks good but traces aren’t showing up. perf meta data are on the result as expected in the repl, just don’t see the trace stufff
figured it out, at a high level lol. i created a new project with just p3, worked fine. added the p2 dep, still worked fine. went back to my app, still broken. but i then removed a require in my user ns that was transitively pulling in p2 stuff, and voila! so not sure of the specifics but it’s a p2/p3 thing for sure
gotcha, can you make a repro case?
ok ugh, it’s happening again lol
using pathom 2 I guess?
do you have the trace plugin installed?
it’s pathom3, but i do have pathom2 jars, etc. i’m migrating the app, so just created a new ns to start playing with the v3 parser
pathom 3 always have trace, not sure what may be going on, tried following docs from pathom viz connector?
or using via http?