Fork me on GitHub
#graphql
<
2023-03-31
>
hlship22:03:14

I think some of the changed in lacinia 1.2 broke subscriptions. I have part of the fix in lacinia-pedestal, but I may need to change lacinia to make it fully work and work properly. This has me bummed.

hlship22:03:00

Essentially, for subscriptions, lacinia-pedestal invokes the streamer for the subscription field (e.g., Subscription/ticks in the https://github.com/walmartlabs/lacinia-pedestal/blob/master/dev-resources/demo-schema.edn, passing it a source-stream callback function. The thread started by the streamer function passes a value to the callback, which becomes the resolved-value when executing the query. That's a problem, because the query selection is for the subscription field (Subscription/ticks) but the value is a tick object. So the selection is right, but the value is wrong; it has to be wrapped with the fields name (:ticks in this case) so that when the query executes, there's a non-null value to perform sub-selections on (the :count and :time_ms fields from the selection).

hlship22:03:23

That works for the success case, but if the callback is passed a wrapped value (such as via with-error) then things are not working correctly; the errors are ignored and lacina then performs the sub-selections on a nil value, triggering validation errors about non-null fields.

hlship22:03:14

So the layers of indirection are making me dizzy, but I'm sure there's a solution here, somewhere.

2
hlship22:03:49

It's possible I can detect if it's a wrapped value and re-wrap it if so.

hlship23:03:37

But I want it to be clean, to support subscription implementations for other HTTP implementations besides Pedestal.

hlship23:03:52

And clean may not be possible with out a change to lacinia.