graphql

hlship 2020-02-07T00:16:20.032700Z

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

miguelb 2020-02-07T17:25:50.035300Z

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

miguelb 2020-02-07T17:27:13.035400Z

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

miguelb 2020-02-07T17:27:59.035600Z

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

miguelb 2020-02-07T17:32:41.035900Z

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

2020-02-07T17:38:09.036100Z

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

2020-02-07T17:38:26.036300Z

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

miguelb 2020-02-07T17:43:46.036500Z

Thank for looking.

miguelb 2020-02-07T17:44:03.036700Z

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)

miguelb 2020-02-07T17:44:45.037Z

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

2020-02-07T17:45:31.037200Z

that is just the machinery inside the promises

2020-02-07T17:46:36.037400Z

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

2020-02-07T17:47:29.037600Z

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

miguelb 2020-02-07T17:47:57.037800Z

ah, ok I’ll try that, thanks again