Fork me on GitHub
#pathom
<
2022-08-15
>
sheluchin17:08:39

I find debugging Pathom resolvers/mutation errors very difficult. Are there any articles or other resources that can help me?

wilkerlucio17:08:14

what is current debug flow, can you tell me what kind of issue you trying to debug?

sheluchin17:08:35

For example the issue I'm dealing with right now is in using the GraphQL GitHub integration alongside my own resolvers. I'm running into an issue where I can make a request for :github.Repository/stargazerCount, and I can make a request for :github.Repository/description, but when I make a request for both of them together like [:github.Repository/stargazerCount :github.Repository/description], the description always fails. My general approach to troubleshooting this sort of thing is to try to decompose the request into smaller parts - that's how I know that requesting the attributes individually works - and tapping inside resolvers to make sure the inputs are provided. I look at the graph in Viz as well, but at least in this particular example, I don't know how to use the visualization to solve the problem

wilkerlucio18:08:10

I think understanding how to read the graph can greatly help, does the arrow and nodes in this graph make sense to you?

sheluchin18:08:48

Yes, it kind of does. I've read over the Planner page and the debugging page before. The color legend is straightforward. So here it looks like the bottom AND node is the problem. The black arrows only go after the orange arrows go, but the nodes that the orange arrows point at are grey, meaning they didn't execute. I guess that's why the red node is there? I don't have the clearest understanding of the picture here.

wilkerlucio18:08:09

the reason they don't executed is likely to be because they already ran somewhere else (duplicated node), what I would look for in this is at the red clal to pathom-entry-dynamic-resolver, if you click on it you can see the details like: what input values it used, what AST call it made

wilkerlucio18:08:55

if the inputs looks wrong for example, then I start navigating back in the graph to see what the previous resolver has done

sheluchin19:08:22

In this case, the red node is the one for description:

:com.wsscode.pathom3.connect.runner/node-resolver-input {}},
   :missing {:github.types/Repository {}},
   :required {:github.types/Repository {}}},
  :com.wsscode.pathom3.error/error-message
  "Insufficient data calling resolver 'github/pathom-entry-dynamic-resolver. Missing attrs :github.types/Repository",
The previous node is the one that gets stargazerCount:
{:com.wsscode.pathom3.connect.operation/op-name
 github/repository-ident-entry-resolver,
 :com.wsscode.pathom3.connect.planner/expects
 {:github.types/Repository {}},
 :com.wsscode.pathom3.connect.planner/input
 {:github.Repository/name {}, :github.User/login {}},
 :com.wsscode.pathom3.connect.planner/node-id 152,
 :com.wsscode.pathom3.connect.planner/node-parents #{190},
 :com.wsscode.pathom3.connect.planner/run-next 138,
 :com.wsscode.pathom3.connect.runner/node-done? true,
 :com.wsscode.pathom3.connect.runner/node-resolver-input
 {:github.Repository/name "pathom3",
  :github.User/login "wilkerlucio"},
 :com.wsscode.pathom3.connect.runner/node-resolver-output
 {:github.Repository/stargazerCount 111},
And I have an entrypoint which uses the repo name and owner:
::p.gql/root-entries-map {"repository" {"name"  ["Repository" "name"] 
                                        "owner" ["User" "login"]}     
It looks like stargazerCount is able to use the entrypoint, but the entrypoint does not get used for the subsequent :github.Repository/description call. Does that seem like the correct interpretation @U066U8JQJ?

wilkerlucio19:08:49

yeah, looks right, this could be a bug in the graphql impl, or in the dynamic resolver in general

wilkerlucio19:08:06

if you can cook a demo repro I'll be glad to take a look

wilkerlucio21:08:53

yes please, in Pathom 3 repo 🙂

sheluchin21:08:00

Okay, here it is https://github.com/wilkerlucio/pathom3/issues/151 Your Slack status says you're on vacation, @U066U8JQJ. This stuff can wait! Please enjoy your vacation and thank you for the help today.

🙏 1
wilkerlucio17:08:36

@UPWHQK562 I did a fix, but I see more things to improve, if you bump pathom3-graphql to latest it should work

wilkerlucio17:08:43

I add more details in the issue

sheluchin17:08:36

@U066U8JQJ thanks very much. I'll test it in the next few days. Glad to hear you found more areas for improvement. The GraphQL integration stuff feels a bit like magic when everything is working. If there's any testing or intel I can provide please let me know.

wilkerlucio23:08:59

@UPWHQK562 just got the new optimizations in! check what the graph looks like now 🙂

sheluchin00:08:28

@U066U8JQJ now that's a much cleaner picture :) looking forward to making use of this. Thanks!