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) where x={}, v=::p/reader-error
So something needs to be changed there as well.
When I run this query:
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-stamperbut it is not due to this part:When called, the input
errorsis{["_subscription_phoneNumber_98765432"] ...},pathis [[:subscription/phoneNumber 98765432]], butpath'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-stamperto detect the error, it will cause another error inpull-idents(called fromgraphql-resolveto process the result of(parser-item ...)because it will be called withdatalike this:{[:subscription/phoneNumber "98765432"] :com.wsscode.pathom.core/reader-error}]and it will fail withSo something needs to be changed there as well.