Fork me on GitHub
#graphql
<
2020-02-07
>
hlship00:02:20

Just pushed rc's of lacinia to clojars. Going to put them up in production in the next couple of days.

miguelb17:02:50

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

miguelb17:02:13

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

miguelb17:02:59

I should add i’m still learning the in and outs of clojure 🙂

miguelb17:02:41

I should also add the each of the sections requires a different api call.

hiredman17:02:09

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

hiredman17:02:26

(also you can use future instead of all that thread starting stuff)

miguelb17:02:46

Thank for looking.

miguelb17:02:03

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)

miguelb17:02:45

starts with with my initial resolver and end with some lacinia internal

hiredman17:02:31

that is just the machinery inside the promises

hiredman17:02:36

you can but printlns like (println 1) (println 2) throughout lookup-patient to figure out the execution path through the function

hiredman17:02:29

and it might be helpful to print out the exception in your catch clause before trying to deliver

miguelb17:02:57

ah, ok I’ll try that, thanks again