Fork me on GitHub
#aleph
<
2019-07-08
>
dimovich09:07:02

did anyone bump into this kind of error? any tips appreciated

mccraigmccraig09:07:15

@dimovich looking at the stacktrace you are attempting to use a vanilla ring middleware which doesn't support Deferred responses

dimovich18:07:08

@mccraigmccraig What's the best approach here? Only thing that I see possible is to wrap my initial handler with a middleware that will dereference the Deferred.

mccraigmccraig18:07:43

derefing is pretty much a no-no for an async program - you will block a thread and possibly cause a deadlock (the only places derefing makes sense are in the repl and maybe in a sync test driving async code). either find a different middleware which is async compatible, or copy the existing middleware and modify it to be async friendly

dimovich21:07:23

thank you for the tips! will experiment with that.

oyakushev09:07:28

Apparently, your handler returns a Deferred, but you have some Ring middleware that post-processes the response.

dimovich18:07:18

@alexyakushev yes, ring.middleware.session/wrap-session is trying to read the Deferred response and fails. Seems there is a project that provides async versions of middlewares -- https://github.com/muhuk/aleph-middleware