This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-25
Channels
- # announcements (1)
- # babashka (15)
- # biff (15)
- # calva (9)
- # cherry (18)
- # cider (43)
- # cljs-dev (1)
- # cljsrn (10)
- # clojure (14)
- # clojure-europe (47)
- # clojurescript (29)
- # clr (5)
- # conjure (1)
- # core-logic (17)
- # datomic (8)
- # emacs (22)
- # fulcro (3)
- # gratitude (1)
- # hoplon (23)
- # humor (1)
- # hyperfiddle (34)
- # jobs (1)
- # kaocha (1)
- # malli (3)
- # nrepl (4)
- # off-topic (18)
- # pathom (12)
- # pedestal (1)
- # polylith (1)
- # portal (17)
- # practicalli (1)
- # re-frame (19)
- # reitit (8)
- # releases (1)
- # rewrite-clj (4)
- # shadow-cljs (15)
- # sql (23)
- # tools-build (4)
Hi! I'm trying to upgrade from v0.6.0 to 0.7.9 and just upgrading the libs works fine but I'm trying to also upgrade the code to be in line with latest template (feels like it'll be easier to stay up to date in the long run) and after doing the Stop using biff/system, biff/start-system, and biff/refresh
step I get this when I try to load the page:
> HTTP ERROR 500 No implementation of method: :db of protocol: #'xtdb.api/DBProvider found for class: nil
I know it's not much information to go on but I thought I'd ask in case it's a common mistake - fwiw I'm not using xtdb (no biff/use-xt and biff/use-tx-listener).
My silly mistake, of course - I'd missed out the fact that my starting system included:
:biff/merge-context-fn identity
Though I'm wondering @U7YNGKDHA if assoc-db
should be something like this:
(defn assoc-db [{:keys [biff.xtdb/node] :as ctx}]
(if node
(assoc ctx :biff/db (xt/db node))
ctx))
Because right now use-jetty as this baked-in assumption that you're using the xtdb component as well (which, granted, you can get out of with merge-context-fn)> Because right now use-jetty as this baked-in assumption that you're using the xtdb component as well
I wouldn't say that--the whole point of introducing the merge-context
fn was to add a layer of indirection so that use-jetty
and other components don't have to make that assumption. Given that, I'm not sure if there'd be any benefits to having assoc-db
work conditionally (?).
Random question--since you're not using xtdb, would it be beneficial if there was an easy way to have biff not pull in xtdb as a transitive dep? Or does it not matter? I guess as long as you don't run into any dependency conflict problems it's probably not a huge issue. But I have for a while thought about various ways to restructure Biff to accommodate that without overcomplicating things.
> Given that, I'm not sure if there'd be any benefits to having assoc-db
work conditionally (?).
Except maybe as an extra guardrail I suppose
yeah that's fair - I don't feel that strongly about it either way as long as there's an escape hatch tbh - but I remember the first time it threw me and I had to hunt through the source to find it and now I just did it again and so could make life trickier for people less willing/able to do so? but yeah, I wouldn't jump to change it but maybe something to think about 😄
and whilst yes it would be nice not to have unnecessary deps, I think part of the point of biff is that it just works out of the box so definitely wouldn't want to overcomplicate things - I imagine I could use exclusions actually? :thinking_face:
yeah:
com.biffweb/biff {:git/url "", :tag "v0.7.9", :sha "7890f70"
:exclusions [com.xtdb/xtdb-core com.xtdb/xtdb-jdbc com.xtdb/xtdb-rocksdb]}
haha totally! I think what I should do at a minimum is write a how-to guide that shows how to replace XT with postgres/sqlite, and then that can discuss the merge-context
fn.
And yeah, exclusions are part of what I was planning on. The only complication is that Biff will still try to require the xtdb lib, i.e. if you start the app with that in your deps.edn then I'm pretty sure the require will throw an exception, unless I grossly misunderstand something. I was thinking of providing some mock versions of xtdb + possibly other libs, so in addition to adding the exclusions, you can add a dependency to those mock versions.
(the mock versions would have the same API, but all the fns would throw UnsupportedOperationException) You could of course make a mock lib yourself, but it'd probably be best if I provide an official mock lib so that it's always up-to-date
haha yeah, I shouldn't have to go that far hopefully
and fwiw I'm not replacing xtdb with anything, I probably will need it anyway if things develop, the project just hasn't move beyond the "spreadsheet as database" stage yet 😅
ah gotcha! maybe two separate guides would be best, or something