Just pushed rc's of lacinia to clojars. Going to put them up in production in the next couple of days.
Hello, I’m trying to prototype using Lacina with wrapping a REST api and having some issues with async resolvers. I followed the example from the relevant docs. However, I’m getting ” May only realize a ResolverResultPromise once” when trying to resolve the rest of the sub objects off off the main query. Here’s what I’m trying to do: https://gist.github.com/miguelbermudez/10a4f2bcb2d6fe457a6d4a87e9384176
If I make a query for just patient
it works, if I query for patient { surgery { } }
that works. If I try to get patient { surgery {} pathology {} }
that results in an the error
I should add i’m still learning the in and outs of clojure 🙂
I should also add the each of the sections requires a different api call.
I don't see anything that jumps out, the rest of the stacktrace from that exception should tell you where the error is happening, which will tell you if it is happening in one of the functions you wrote, or in the internals of lacina
(also you can use future instead of all that thread starting stuff)
Thank for looking.
this is the stacktrace:
Exception in thread "Thread-21" java.lang.IllegalStateException: May only realize a ResolverResultPromise once.
at com.walmartlabs.lacinia.resolve$resolve_promise$reify__1875.deliver_BANG_(resolve.clj:167)
at com.walmartlabs.lacinia.resolve$resolve_promise$reify__1875.deliver_BANG_(resolve.clj:183)
at ddp.graphql.schema$lookup_patient$fn__27609$fn__27611.invoke(schema.clj:89)
at clojure.lang.AFn.run(AFn.java:22)
at java.base/java.lang.Thread.run(Thread.java:830)
starts with with my initial resolver and end with some lacinia internal
that is just the machinery inside the promises
you can but printlns like (println 1)
(println 2)
throughout lookup-patient to figure out the execution path through the function
and it might be helpful to print out the exception in your catch clause before trying to deliver
ah, ok I’ll try that, thanks again