Fork me on GitHub
#cider
<
2023-12-21
>
dergutemoritz10:12:38

Hey there, I am AOT-compiling a project and would like to include cider-nrepl for the purpose of starting an nrepl server via nrepl.server/start-server using cider.nrepl/cider-nrepl-handler as the handler. This fails then when attempting to connect to the running server built this way due to the delayed loading of the middleware dependencies. Can you recommend a way to eagerly load them? Or any other workaround which doesn't require me to manually require all orchard.* namespaces etc.?

dergutemoritz10:12:22

Problem being that the AOT compilation doesn't consider the middleware dependencies since they're only loaded at runtime, of course

dergutemoritz11:12:48

OK I couldn't find a way to programmatically do this. Tried instantiating every middleware in cider.nrepl.middleware/cider-middleware with a noop handler and passing a mock message into it but that became very hacky very quick. I've now resorted to copy & pasting all cider.nrepl.middleware.* namespaces and requiring them explicitly on my end. This will of course fail as soon as new default middlewares are introduced or old ones are removed ...

vemv11:12:13

Note this caveat though https://clojurians.slack.com/archives/C0617A8PQ/p1703023709316259?thread_ts=1703021398.963639&amp;cid=C0617A8PQ In the thread you can find a couple ways in which we recommend to run (cider) nrepl in production

dergutemoritz12:12:23

Thanks for the feedback! Alright, I'll go ahead with the minimal nrepl server then, should be good enough 🙂

🙌 1