Fork me on GitHub
Aleksander Rendtslev00:01:32

I’m trying to get the “Index Explorer” page to work, but nothing shows up when I press Load index. • I’ve mirrored the patho.clj parser from Fulcro Native Template • I’ve mirrored the middleware as well • I do get what looks like a succesfull response This is what I see:

Aleksander Rendtslev00:01:58

I tried the Pathom Viz explorer and it throws the following error:

java.lang.RuntimeException: java.lang.Exception: Not supported: class com.wsscode.pathom.connect$fn__31906
	at com.cognitect.transit.impl.WriterFactory$1.write(
	at cognitect.transit$write.invokeStatic(transit.clj:167)
	at cognitect.transit$write.invoke(transit.clj:164)
	at com.fulcrologic.fulcro.server.api_middleware$write.invokeStatic(api_middleware.clj:151)
	at com.fulcrologic.fulcro.server.api_middleware$write.invoke(api_middleware.clj:148)
	at clojure.lang.AFn.applyToHelper(
	at clojure.lang.AFn.applyTo(
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.core$update_in$up__6853.invoke(core.clj:6185)
	at clojure.core$update_in.invokeStatic(core.clj:6186)
	at clojure.core$update_in.doInvoke(core.clj:6172)
	at clojure.lang.RestFn.invoke(
	at com.fulcrologic.fulcro.server.api_middleware$wrap_transit_response$fn__38673.invoke(api_middleware.clj:169)
	at ring.middleware.resource$wrap_resource_prefer_resources$fn__39075.invoke(resource.clj:25)
	at ring.middleware.content_type$wrap_content_type$fn__38877.invoke(content_type.clj:34)
	at java.base/java.util.concurrent.Executors$
	at java.base/
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.base/java.util.concurrent.ThreadPoolExecutor$
	at java.base/
Caused by: java.lang.Exception: Not supported: class com.wsscode.pathom.connect$fn__31906
	at com.cognitect.transit.impl.AbstractEmitter.marshal(
	at com.cognitect.transit.impl.JsonEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.marshal(
	at com.cognitect.transit.impl.JsonEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.marshal(
	at com.cognitect.transit.impl.JsonEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.marshal(
	at com.cognitect.transit.impl.JsonEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.emitMap(
	at com.cognitect.transit.impl.AbstractEmitter.marshal(
	at com.cognitect.transit.impl.AbstractEmitter.marshalTop(
	at com.cognitect.transit.impl.JsonEmitter.emit(
	at com.cognitect.transit.impl.WriterFactory$1.write(
	... 20 more


looks like some encoding issue, do you have any nom standard types in your data?


and are you using the native app, or via fulcro inspect?

Aleksander Rendtslev00:01:53

I’m using the native Fulcro App (and the native Pathom Viz app) When you say, none standard types in my data, do you mean the resolver and mutation definitions?:

(defmutation upsert-entry!
  [{:keys [crux-node]}
   {:entry/keys [id
                 refs] :as entry}]
  {::pc/input #{:entry/id :entry/text :entry/refs}
   ::pc/output [:entry/id]}
  (upsert-entry crux-node entry))

(defresolver entry-resolver
  [{:keys [crux-node]} id]
  {::pc/input #{:entry/id}
   ::pc/output [:entry/text]}
  (repo/get crux-node id))

Aleksander Rendtslev00:01:19

These, outside of the index-resolver, are the only ones that are registrered right now

Aleksander Rendtslev00:01:56

hmm… This is all I’m registrering now. And I’m still getting the error:

(pc/defresolver index-explorer [env _]
  {::pc/input  #{:com.wsscode.pathom.viz.index-explorer/id}
   ::pc/output [:com.wsscode.pathom.viz.index-explorer/index]}
   (get env ::pc/indexes)})

(def all-resolvers [index-explorer])

Aleksander Rendtslev00:01:25

This is my parser:

(defn build-parser [crux-node]
  (let [real-parser
          {::p/mutate  pc/mutate-async
           ::p/fail-fast? true
           ::p/env     {::p/reader [p/map-reader
                        ::p/process-error process-error
                        ::p/placeholder-prefixes #{">"}}
           ::p/plugins [(pc/connect-plugin {::pc/register all-resolvers})
                        (p/env-wrap-plugin (fn [env]
                                             ;; Here is where you can dynamically add things to the resolver/mutation
                                             ;; environment, like the server config, database connections, etc.
                                             (assoc env
                                                    :crux-node crux-node
                                                    :config *config*)))
                        (preprocess-parser-plugin log-requests)
                        (p/post-process-parser-plugin p/raise-errors)
                        (p/post-process-parser-plugin p/elide-not-found)
        ;; NOTE: Add -Dtrace to the server JVM to enable Fulcro Inspect query performance traces to the network tab.
        ;; Understand that this makes the network responses much larger and should not be used in production.
        trace?      (not (nil? (System/getProperty "trace")))]
    (fn wrapped-parser [env tx]
      (async/<!! (real-parser env (if trace?
                                    (conj tx :com.wsscode.pathom/trace)


there is an annoying issue with sending the index in pathom 2, that it tries to send the resolver and mutations functions with the index, and that breaks encoding, it shouldnt because we do have a default handler, but this issue seems to keep getting back


one way around it is to manually remove this fns from those index before sending (do it at the resolver that exposes the indexes)


not sure if thats the problem you are seeing, but I think is worth trying

Aleksander Rendtslev01:01:11

Is that’s what’s done here? (from the Fulcro example):

(pc/defresolver index-explorer [env _]
  {::pc/input  #{:com.wsscode.pathom.viz.index-explorer/id}
   ::pc/output [:com.wsscode.pathom.viz.index-explorer/index]}
   (-> (get env ::pc/indexes)
       (update ::pc/index-resolvers #(into [] (map (fn [[k v]] [k (dissoc v ::pc/resolve)])) %))
       (update ::pc/index-mutations #(into [] (map (fn [[k v]] [k (dissoc v ::pc/mutate)])) %)))})

Aleksander Rendtslev01:01:28

(still not working if that’s the case)


yeah , should be it, from the error stack seems like some fn is trying to get encoded


a better fix is try to fix the default encoder


you can try bumping transit, it had a but around default write handler in some versions

Aleksander Rendtslev00:01:39

I’m still trying to figure out this issue, but thank you for helping out! About the default write handler example: What do I need to do with it? Where do I put it? I don’t have any experience with transit, so I’m still trying to decipher what’s happening. I copied the ::pc/indexes output to see if you can see any clues as to which of the functions is the culprit. In that case I can write logic to dissoc the extra properties per the fulcro example. I’m surprised i’m hitting this though: I hardly have any resolvers at all

Aleksander Rendtslev00:01:47

I copied the code from this example first, and lastly the one you linked above: But where do I put it? In one of my own namespaces, and then I load it? Or should I add it to the parser?


hello, looking at your code I can see :com.wsscode.pathom.connect/resolve #function[com.wsscode.pathom.connect/fn--39871], so its trying to send functions over the wire


the write handler needs to go in whatever part of your code you do the Transit encoding


had you tried using the Pathom Viz standalone app? (with the pathom-viz-connector, the setup there should work)

Aleksander Rendtslev18:01:48

Hmm, it’s starting to make sense. I’m using the standard wrap-transit-response middleware from fulcro right now

Aleksander Rendtslev18:01:24

Using this from the Fulcro RAD example worked:

(pc/defresolver index-explorer [{::pc/keys [indexes]} _]
  {::pc/input  #{:com.wsscode.pathom.viz.index-explorer/id}
   ::pc/output [:com.wsscode.pathom.viz.index-explorer/index]}
     (remove (comp #{::pc/resolve ::pc/mutate} key))
I’ll try to submit it to the fulcro-template and the fulcro-native-templates so they are up to date

👍 3

Hi there, I have a console error ERROR [com.fulcrologic.fulcro.routing.dynamic-routing:133] - route-immediate was invoked with the ident [:component/id :main] which doesn't seem to match the ident of the wrapping component (class Main , ident [ null ...]) which I'm not sure how to fix it. Here's what I have:

(defn ^:export init []
  (log/merge-config! {:output-fn prefix-output-fn
                      :appenders {:console (console-appender)}})
  (log/info "Starting App")
  ;; Avoid startup async timing issues by pre-initializing things before mount
  (app/set-root! app Root {:initialize-state? true})
  (dr/initialize! app)
  (app/mount! app Root "app" {:initialize-state? false})
  (dr/change-route! app (dr/path-to Main)))
;; Root
(defrouter RootRouter [_ {:keys [current-state]}]
  {:router-targets [Login Main]}
  (case current-state
    :pending (dom/div "Loading...")
    :failed (dom/div "Loading seems to have failed. Try another route.")
    (dom/div "Unknown route")))

(def ui-root-router (comp/factory RootRouter))

(defsc Root [this {:root/keys [router]}]
  {:query         [{:root/router (comp/get-query RootRouter)}]
   :initial-state {:root/router {}}}
    (ui-button {:onClick #(dr/change-route this ["main"])} "Go to main")
    (ui-button {:onClick #(dr/change-route this ["login"])} "Go to login")
    (ui-root-router router)))
;; Main
(defsc Main
  [_ _]
  {:indent        [:component/id :main]
   :route-segment ["main"]
   :query         [:main]
   :initial-state {:main {}}
   :will-enter    (fn [_ _] (route-immediate [:component/id :main]))}
  (dom/h1 "Main!"))

(def ui-main (comp/factory Main))
It works fine(?) but that console error is thrown every time I change-route!. Would appreciate any help. Thanks in advance.


:ident (fn [] [:component/id :main])


if you supply a vector (like you did) it means (fn [] [:component/id (:main props)])


and if you supply just a keyword :ident :k it means (fn [] [:k (:k props)])


and docstring


Ah I see. Thanks for pointing me in the right direction 🙂


Also I just realised something profoundly silly: I've been reading and using indent the entire time instead of ident.


That is some massive facepalm right there


ah yes, and if you do that you don’t get normalization at all 😜


haha I've looked at fulcro code for so long and it has never occurred to me once that I've been reading it wrong since the beginning


and... changing to the right word fixes all the console errors


hi @tony.kay it is probably small thing but wanted to let you know: when i searched fulcrologic using duckduckgo, it has indexed and shows at the top which return 404 resulting in not opening the page from the search results. Trying it manually did redirect to home page but "opening in new tab" or copy pasting it returns 404 as well.


Fixed. Thanks. I recently deployed a new site that uses diff URIs.