Description
When I run this query:
(parser {}
[{[:mygql.subscription/phoneNumber "98765432"]
[:mygql.SubscriptionData/roles]}])
Pathom gets this response:
#:com.wsscode.pathom.diplomat.http{
:status 200,
:body {:data nil,
:errors [{:path ["_mygql_subscription_phoneNumber_98765432"],
:data nil, :errorType "AUTHENTICATION", :errorInfo nil,
:message "INVALID_OR_EXPIRED_AUTH_TOKEN"}]}, ...}
but the result the user gets is
{[:mygql.subscription/phoneNumber "98765432"] {}}
i.e. the error is swallowed instead of being made into a reader error.
It should be caught and propagated by com.wsscode.pathom.connect.graphql2/error-stamper
but it is not due to this part:
(let [path' (mapv #(cond
(p/ident? %)
(demung (namespace (first %))) ; <----
When called, the input errors
is {["_subscription_phoneNumber_98765432"] ...},
path is [[:subscription/phoneNumber 98765432]]
, but path'
becomes only [subscription]
instead of ["_subscription_phoneNumber_98765432"]
. The error is thus not considered to be a "local error" and is ignored.
A fix would be I guess to replace (namespace (first %)))
with (com.wsscode.pathom.graphql/ident->alias %)
but I assume that the current code is there for a reason and is the right way to do it in other circumstances.
I'd be more than happy to send a PR if you can guide me to as when to use (namespace (first %)))
vs. ident->alias
.
Follow-up error
When I fix error-stamper
to detect the error, it will cause another error in pull-idents
(called from graphql-resolve
to process the result of (parser-item ...)
because it will be called with data
like this: {[:subscription/phoneNumber "98765432"] :com.wsscode.pathom.core/reader-error}]
and it will fail with
Parser Error: Don't know how to create ISeq from: clojure.lang.Keyword {}
when trying to(into x v)
wherex={}, v=::p/reader-error
So something needs to be changed there as well.