Fork me on GitHub
#pathom
<
2022-08-21
>
nivekuil17:08:37

trying to use pathom-viz-connector from within a container. I can curl the pathom-viz IP:8240 from inside the container, and :com.wsscode.pathom.viz.ws-connector.core/host is set to that IP, but nothing's showing up in pathom-viz. I looked at the code https://github.com/wilkerlucio/pathom-viz-connector/blob/1d2662b410f262f74da542b7743b23f1438e3adb/src/com/wsscode/pathom/viz/ws_connector/impl/http_clj.clj and it looks like host and port might be ignored in the clj impl?

👀 1
wilkerlucio17:08:47

Pathom 3 does this automatically via the boundary interface

wilkerlucio17:08:06

wait, maybe not, let me check something

wilkerlucio17:08:33

yup, thats right, boundary interface does it, you can copy from it if you like to do it without using the boundary context: https://github.com/wilkerlucio/pathom3/blob/1e440a61243dc1dea59e4946ebffc4ac424253f4/src/main/com/wsscode/pathom3/interface/eql.cljc#L176

nivekuil17:08:11

what do I need on my end? I thought the boundary interface was a client api, so pathom-viz does it. I just have the parser http endpoint

wilkerlucio17:08:15

you should use the boundary interface in your http handler, so it supports the pathom API format and also include indexes (which will make index explorer available)

wilkerlucio17:08:52

also your endpoint needs spit transit, with the transit encoders setup

nivekuil17:08:47

ok, that was really easy to change. thanks :)

nivekuil17:08:05

can I get traces from the Query tab of pathom-viz or is that only through the connector

wilkerlucio17:08:21

you should be able to get traces too, but there is one more thing you have to do, that is expose the metadata of the entities via transit

wilkerlucio17:08:37

the :transform t/write-meta on the example config tutorial

wilkerlucio17:08:55

(this is a transit config, if you are using it directly you should be able to set it there)

wilkerlucio17:08:24

that's because trace info comes via metadata in the response maps

nivekuil18:08:41

hm, one resolver returns a response with its own metadata, where the metadata contains a function, so it can't be serialized. Is this bad practice to have metadata in my output?

wilkerlucio18:08:18

ideally nothing should break serialization

wilkerlucio18:08:10

I made this wrapper on Transit just to get this working properly: https://github.com/wilkerlucio/transito

wilkerlucio18:08:57

what you need is to set the transit default handler to some "unknown" thing, so it can output it, I had issues in the past trying to make that strait on transit writer, so I have written my own writer that does it, maybe nowadays its fixed in Transit and you can just configure there instead of making a custom Writer

nivekuil18:08:12

I might just refactor this to get rid of the metadata. The problem it's solving is setting a cookie from mutation, so the metadata is a function run by the ring handler to transform the response

nivekuil18:08:35

it seems pretty easy to set the default handler now, just :default-handler (transit/write-handler (fn [￱_￱] "unknown") #(pr-str %)) in muuntaja's :encoder-opts