This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-08
Channels
- # aleph (10)
- # announcements (4)
- # beginners (25)
- # calva (4)
- # cider (56)
- # clj-kondo (10)
- # cljdoc (1)
- # cljs-dev (58)
- # clojure (42)
- # clojure-austin (5)
- # clojure-dev (90)
- # clojure-europe (2)
- # clojure-greece (2)
- # clojure-italy (3)
- # clojure-nl (63)
- # clojure-quebec (1)
- # clojure-seattle (2)
- # clojure-spain (4)
- # clojure-spec (19)
- # clojure-uk (25)
- # clojuredesign-podcast (5)
- # clojurescript (24)
- # cursive (15)
- # datomic (1)
- # events (1)
- # figwheel-main (10)
- # fulcro (62)
- # graphql (7)
- # keechma (11)
- # nrepl (1)
- # off-topic (12)
- # re-frame (8)
- # reitit (2)
- # remote-jobs (3)
- # shadow-cljs (127)
- # specter (1)
- # sql (43)
- # testing (2)
- # tools-deps (30)
- # xtdb (1)
@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
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