Hello all
did anyone bump into this kind of error? any tips appreciated
@dimovich looking at the stacktrace you are attempting to use a vanilla ring middleware which doesn't support Deferred
responses
@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.
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
thank you for the tips! will experiment with that.
Apparently, your handler returns a Deferred, but you have some Ring middleware that post-processes the response.
@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
@mccraigmccraig @alexyakushev thanks!