beginners

Getting started with Clojure/ClojureScript? Welcome! Also try: https://ask.clojure.org. Check out resources at https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f.
Endre Bakken Stovner 2021-05-05T05:05:26.136700Z

I gzipped the entire folder when moving the code to my new machine so I thought the error could not be due to missing files. Also, it said compile error so I thought it wasn't due to things happening when my code was running. So these lines mean it happened in my user.clj file? [user$eval42029 invokeStatic "form-init16520803458208972728.clj" 1] [user$eval42029 invoke "form-init16520803458208972728.clj" 1] Thanks, I actually learned a lot. It is also the first time I've seen a stack trace like that so I imagined it had something to do with my new Clojure version having failed to install properly or something.

Kenneth Gitere 2021-05-05T05:59:21.138500Z

Hi guys! I'm still having a hard time fully understanding how to write Clojure macros. Are there any resources online for practising writing Clojure macros? I'm only learning about them so I don't have any examples of macros I've written incorrectly

dpsutton 2021-05-05T06:02:19.140800Z

two resources: - clojure for the brave and true chapter on macros: https://www.braveclojure.com/writing-macros/ - http://grep.app search for (defmacro https://grep.app/search?q=%28defmacro&filter[lang][0]=Clojure

πŸ‘ 1
zackteo 2021-05-05T06:02:34.141300Z

Hi everyone, I understand I can use reduce to do (reduce + [3 3 2]) => 8 But how do I use reduce to get (reduce + [[3 3][3 2][1 1]]) => [7 6] Do I do something with apply ? :thinking_face:

dpsutton 2021-05-05T06:04:36.141600Z

(let [pairwise (fn [x y] (map + x y))]
          (reduce pairwise [0 0] [[3 3][3 2][1 1]]))

dpsutton 2021-05-05T06:05:34.142100Z

pairwise addition is just adding first with first, second with second, and then reduce that over the collection of pairs

zackteo 2021-05-05T06:14:04.143300Z

Sorry am a bit confused. If I want to extend it to 3. Should I do (apply map + [[3 3 3] [3 3 3] [2 1 3]]) then? Don't really understand how reduce pairwise works

zackteo 2021-05-05T06:16:52.145300Z

okay i think i still need to understand how apply works in such cases :thinking_face:

dpsutton 2021-05-05T06:16:58.145500Z

table=> (let [pairwise (fn [x y] (map + x y))]
          (reduce pairwise [0 0 0] [[3 3 3] [3 3 3] [2 1 3]]))
(8 7 9)
works just fine. it's because of the way map works. (map + [3 3 3] [2 2 2]) will be ((+ 3 2) (+ 3 2) (+ 3 2)) which is pairwise addition. pairwise means in a tuple, to add, add each "position" in one tuple with the same position in the other tuple

dpsutton 2021-05-05T06:18:20.146200Z

i'm not sure apply really gets you anything in this problem of yours

zackteo 2021-05-05T06:19:34.147Z

whoops, I think i somehow skipped over evaluating that snippet, yeah that works

dpsutton 2021-05-05T06:20:26.148300Z

if you really want apply you could do (map #(apply + %) (apply map vector [[3 3 3] [3 3 3] [2 1 3]])) The inner apply will pair up the first elements of all the tuples, then the second elements, and the first apply will add them all

zackteo 2021-05-05T06:20:27.148400Z

apply does seem to work too (apply map + [[1 2 3 4] [1 2 3 4] [1 2 3 4]]) ;; => (3 6 9 12)

zackteo 2021-05-05T06:21:09.149Z

apply helps to get rid of the surrounding [] i guess

dpsutton 2021-05-05T06:21:11.149100Z

oh right. of course. sorry about that. i got blinded away from that solution

zackteo 2021-05-05T06:22:41.150100Z

no worries! thanks for your help πŸ˜„

Tim Robinson 2021-05-05T11:17:44.156Z

Hi, I'm using "lein repl" and trying to find out how to do things like history search etc. I've followed the trail from nRepl to https://github.com/trptcolin/reply which claims it has "history navigation and search and much much more" but doesn't contain any user guide. it mentions JLine but that doesn't seem to have a user guide either. can anyone point me at some documention to get me started?

flowthing 2021-05-05T11:45:55.156200Z

I think lein repl uses readline if you have it installed, so history search specifically should be Ctrl+R. Obligatory "prefer evaluating things from your editor instead of typing into the REPL" caveat applies here, though. πŸ™‚

FHE 2021-05-05T12:18:02.158900Z

So I'm trying to get started with shadow-cljs, and there seem to be 3 options for dependency management: shadow-cljs itself (using shadow-cljs.edn), leiningen (using project.clj), or deps.edn (tools.deps is something related but I don't understand it at this point).

FHE 2021-05-05T12:18:38.159600Z

Is there a good argument for using any of the 3 options over the others? Actually I really don't want to add yet another tool, so Leiningen is probably out for me.

FHE 2021-05-05T12:22:12.161Z

I'm guessing using shadow-cljs.edn will be a bit 'smoother', but using deps.edn will give me more well-rounded practice (since I would be using I would be able to use any future projects without shadow-cljs).

Ryan 2021-05-05T12:38:13.165900Z

Hey all, still getting my feet wet and had a question about the most clojure-y way to approach something: I have a big map for various settings for authentication, e.g. endpoints, urls, token settings … when I’m actually using the map, I want there to be some sprucing e.g. combine the endpoint and url suffix into one field.. is the idiomatic way to do that to basically have the map, have a function that transforms the map, and always invoke the map by calling the function instead? Right now I just have the map, and the code that consumes it is very verbose e.g. :url (str (get-in map :auth :protocol) (get-in map :auth :baseURL) (get-in map :auth :urlPort) (get-in map :auth :urlSuffix)) Any clues would be appreciated πŸ™‚

Tim Robinson 2021-05-05T12:43:41.166Z

Thanks - the manual page for readline does include some user instructions so that's very useful. I guess a lot of this would be obvious to someone who doesn't use set -o vi in bash :-)

Tim Robinson 2021-05-05T12:47:41.166400Z

as long as the map doesn't change, can't you pre-process it when you read it in (or whenever the namespace loads if it's hard-coded)? if you really need access to the 'raw' version as well, you could just expose both

πŸ‘ 1
βž• 1
Ryan 2021-05-05T12:56:15.166600Z

Thanks for the response, I don’t think I’d need access to the raw version, but we might want to change the map at some point via repl or other dynamic mechanism, but I suppose it would be as elementary as re-running the processing function now that you put it that way

Endre Bakken Stovner 2021-05-05T13:21:21.170500Z

Does anyone know what https://gist.github.com/endrebak/7d238ad32472d94edd93b9deba9c3406 might be due to? They happen when I run lein shadow watch app on a luminus app created with +shadow. The code works on another machine, but when I tgzipped and copied the entire repo to a different machine these errors popped up. An example error is [:failed-to-compare "16.8.6" "16.9.0" ...]

> npm ls
everclear@ /Users/endrebakkenstovner/code/everclear
β”œβ”€β”€ react-dom@16.8.6
So I am pretty sure these errors are due to version mismatches, but I cannot see how to fix them. My package-lock.json:
1718-    "react-dom": {
1719:      "version": "16.8.6",
                     //^^^^^^^
1720:      "resolved": "<https://registry.npmjs.org/react-dom/-/react-dom-16.8.6.tgz>",
Just remembered the project the errors come from is here btw: https://github.com/endrebak/everclear It is just a prototype under construction, so no point looking at the code.

Endre Bakken Stovner 2021-05-05T13:28:00.171100Z

It seems like lein shadow watch app still works, but always complains about stale compilation output.

2021-05-05T13:59:41.171800Z

ns-resolve has an env param, what’s that for. (ns-resolve ns env sym)

2021-05-05T14:18:51.172Z

> is the idiomatic way to do that to basically have the map, have a function that transforms the map, and always invoke the map by calling the function instead? I think it's reasonable to transform data as it flows through a system to meet the needs of whatever component is making use of it - to basically have different data models for different regions of the code.

πŸ‘ 1
Sebastian Ohlsson 2021-05-05T15:13:50.178300Z

Hi guys rookie question here! Can someone give me an example of a next.jdbc transaction.

(defn main
  [budget]
(jdbc/with-transaction [tx ds]

                     
                       (for [b budget]
                         (sql/query tx ["
                        UPDATE hbi_bp.model_no_of_students
                        SET process_status_id = 'Locked'
                        WHERE calendar_id = ?
                        AND calendar_period_id = ?
                        AND organisation_pk = ?
                        AND version_id = ?
                        AND school_type_id = ?
                        AND program_id = ?
                        AND grade_year_id = ?"
                                        (:model_no_of_students/calendar_id b),
                                        (:model_no_of_students/calendar_period_id b),
                                        (:model_no_of_students/organisation_pk b),
                                        (:model_no_of_students/version_id b),
                                        (:model_no_of_students/school_type_id b),
                                        (:model_no_of_students/program_id b),
                                        (:model_no_of_students/grade_year_id b)]))
Im trying to go through an array of maps and update all those values that match without connecting to the db for each "for"-cycle. I can get it to work for the single case (a single row) but I cant go through an array. Any points would be awesome. Have a great evening.

ghadi 2021-05-05T15:17:06.178800Z

for is a lazy sequence comprehension not a loop

ghadi 2021-05-05T15:17:30.179200Z

need something to realize the sequence inside the with-transaction

πŸ‘€ 2
Sebastian Ohlsson 2021-05-05T15:26:26.182500Z

I will look at it again with this. Thanks

gon 2021-05-05T15:37:28.182600Z

shadow-cljs is not for dependency management, it is for ClojureScript, lein and tools.deps are for dependency management

Mark Wardle 2021-05-05T16:40:39.190500Z

Hi all. Can I ask a style question please? I have a service that wraps two other services and provides a nice API. I have a deftype representing that unified facade and then in order to provide the implementation, I’ve added a protocol and implemented the methods for the type. But this feels wrong as I have no intention of providing multiple versions. So is it better to simply use the deftype as a way of holding some internal references and provide functions at a namespace level? I had thought it might be nice to provide Java interop in the future, but the reality is I’m more likely to write a proper Java wrapper and simply invoke functions anyway. TLDR; should I go through the contortions of defining a protocol simply to add implementation methods or is it fine to just use methods that take a handle of a (kinda opaque-ish) service implementation and forgo protocols completely?

Dave Suico 2021-05-05T16:53:21.192600Z

Hi guys, I have to test a csv reader I made and I need to read a csv file that lives somewhere in the resource folder in my codebase. How can I traverse and locate my file? thanks!

Mark Wardle 2021-05-05T16:59:14.193600Z

Hi. Have you seen http://clojure.java.io/resource https://clojuredocs.org/clojure.java.io/resource. As long as the other file is in your class path - you should be able to find it.

George Silva 2021-05-05T17:00:45.195Z

Hello friends! I'm pretty new to Clojure and I'm reading a few books and doing a few exercises. I have a few questions: 1. What are good resources in order to learn "design patterns" or more idiomatic code? 2. What is a good web "framework" (quoted because I do understand that frameworks are not really the clojure way) to get started? I tried several but they all seem a pretty complicated or have a pretty complicated boilerplate code (`lein new ...`). Any interesting resources for beginners that encompass API, database and maybe docker/docker-compose?

tvirolai 2021-05-06T09:22:42.258100Z

β€’ The Clojure style guide (https://github.com/bbatsov/clojure-style-guide) is a good resource for idiomatic style. If you want to go deep into this, check out Zach Tellman's book Elements of Clojure (https://elementsofclojure.com/) β€’ A good way to learn to write idiomatic code is to get feedback on your code. Try checking out the Clojure track (in mentored mode) on http://exercism.com β€’ As to the framework thing, Luminus provides great configurable templates for getting your projects up and running: https://luminusweb.com/

George Silva 2021-05-06T11:22:29.263900Z

@tvirolai thanks!

Dave Suico 2021-05-05T17:03:38.196500Z

Hello there! Currently reading it now as you commented but I do not fully understand classpaths yet. Looking at the image, I think my sample file is separated from the classpath right?

Audrius 2021-05-05T17:03:39.196700Z

Hello! how can we describe the map that is embedded in this defn body

(defn ok []
  {:pre  [(keyword? 6)]
   :post [(number? %)]}
  4)
It is also evaluated and assertions run. What else can go into that map?

Benno LΓΆffler 2021-05-06T20:40:26.270100Z

you may express pre- and post-conditions in Eiffel-style. Its basically assertions regarding the arguments and the result of the function. Example see http://blog.fogus.me/2009/12/21/clojures-pre-and-post/

Dave Suico 2021-05-05T17:05:31.197Z

altho I tried this and it works. Can I see a better call than this?

NoahTheDuke 2021-05-05T17:05:48.197200Z

https://clojure.org/reference/special_forms

βœ”οΈ 1
NoahTheDuke 2021-05-05T17:05:57.197400Z

and https://clojure.org/reference/metadata

βœ”οΈ 1
sb 2021-05-05T17:07:42.198600Z

1) Clojure: The Essential Reference (meap) book > very good and helpful. Timothy Baldrigde Pivotshare video tuts (before this was on YouTube) similar good. Not exactly what you search, but I like both. Im not at laptop, maybe somebody can share better links to idiomatic code.

πŸ‘ 1
2021-05-05T17:08:00.198800Z

It is called "condition-map" in defn form

βœ”οΈ 1
Mark Wardle 2021-05-05T17:08:22.199300Z

It depends on your classpath. Which build tool are you using? You can include arbitrary directories in your classpath. The trouble with using an absolute filename is that it won’t work from a jar file - it works for your development environment only…. now I think some people use git and clj for production, but you’re better getting that path into the classpath, and using io/resource.

alexmiller 2021-05-05T17:08:34.199500Z

you can also see info in (doc defn) (as "prepost-map")

βœ”οΈ 1
alexmiller 2021-05-05T17:08:41.199700Z

those are the only things that can go in it

βœ”οΈ 1
George Silva 2021-05-05T17:10:54.200100Z

@sb thanks!

alexmiller 2021-05-05T17:18:06.200300Z

the cool thing about protocol functions is that from outside the namespace, you invoke them identically to how you'd invoke a non-protocol function

alexmiller 2021-05-05T17:19:08.200500Z

so if you don't use a protocol, you can always start using one later in the implementation without breaking callers

alexmiller 2021-05-05T17:19:55.200700Z

in general, it's usually better to make the API actual functions anyways (as then you have the opportunity to do custom logic there) and use a protocol for the SPI instead

πŸ‘ 1
alexmiller 2021-05-05T17:20:53.201100Z

we follow that pattern in the spec impl and it's been very useful

πŸ‘ 1
2021-05-05T17:27:46.206100Z

Hello everyone :) I am trying to use http-kit behind a proxy and the final endpoint is in https and the proxy is in http. When using babashka.curl/post with Λ‹-x http://myprotoxy:my-port/%60 the request works, but it fails with org.http-kit.client. Same behavior with clj-http.client. Anyone would have a clue why that happens? [i am using Java 8]?

borkdude 2021-05-05T17:28:16.206500Z

@neo2551 Did you enable the SNI client in httpkit?

borkdude 2021-05-05T17:28:46.207300Z

and does it work with the (native) babashka httpkit client. rather than in Java 8?

2021-05-05T17:28:51.207600Z

Probably not.

borkdude 2021-05-05T17:28:56.208Z

(if so, then it's the SNI client problem)

2021-05-05T17:28:57.208100Z

Let me check with babashka.

2021-05-05T17:29:04.208400Z

Thanks for the help!

2021-05-05T17:29:54.209Z

How would you configure it? Just require it?

2021-05-05T17:32:22.209600Z

Thanks!

2021-05-05T17:42:34.209800Z

Doesn't sound like you need a deftype to me. Just use functions like so:

(defn make-service
  [other-service1 other-service2]
  {:other-service1 other-service1
   :other-service2 other-service2})

(defn some-api-for-it
  [service-map other-thing-you-might-need]
  ...)

(defn more-apis-for-it
  [service-map ...]
  ...)
And then a client does:
(def service-instance (service/make-service (FooService.) (BarService.)))
(service/some-api-for-it service-instance "12345")

2021-05-05T17:47:13.210300Z

Nope, it was not that xD

borkdude 2021-05-05T17:48:41.210500Z

but does it work with bb then?

borkdude 2021-05-05T17:49:06.210800Z

> but it fails with org.http-kit.client. Same behavior with clj-http.client oh, I see, then it's not http-kit specific

borkdude 2021-05-05T17:49:19.211100Z

but still good to enable that SNI client

2021-05-05T17:49:58.211400Z

Thanks I will know for the future :)

2021-05-05T17:51:15.213400Z

I am just happy that you wrote curl because my colleague were showing the command by curl and I was a bit embarrassed to fail with httpkit. It also worked with python.requests (so I guess I could have used libpython-clj but in the worst case).

borkdude 2021-05-05T17:52:26.213600Z

ooh it's a proxy

2021-05-06T07:19:22.243500Z

I think the issue is I am using basic authentication method with user:password@proxy-url

borkdude 2021-05-06T07:31:46.245100Z

Maybe read the Java docs about it, I would have to look it up as well :)

2021-05-06T07:43:42.245700Z

I got it working by using https://stackoverflow.com/questions/1626549/authenticated-http-proxy-with-java

borkdude 2021-05-06T07:44:52.246200Z

πŸŽ‰

2021-05-06T07:58:34.247Z

So now, I can make it working with clj-http but not http-kit haha

borkdude 2021-05-06T07:59:13.247300Z

why is that?

2021-05-06T10:14:58.261900Z

I don't know, I have been trying to debug, but I can't log the calls from http-kit.

borkdude 2021-05-05T17:52:30.213800Z

I missed that

borkdude 2021-05-05T17:52:37.214Z

you can set Java properties for this

borkdude 2021-05-05T17:53:21.214500Z

e.g.:

java -Dhttp.proxyHost=<http://webcache.example.com|webcache.example.com> -Dhttp.proxyPort=8080
see https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html This should also work with bb

πŸ‘ 1
borkdude 2021-05-05T17:53:43.214900Z

with the clojure CLI it's -J-Dhttp.proxyHost= etc

πŸ‘ 1
Audrius 2021-05-05T18:01:37.215Z

in (doc defn) documentation there is some attr-map? mentioned. I can not find a good explanation on what it is. What can it be?

alexmiller 2021-05-05T18:35:44.215200Z

metadata map

alexmiller 2021-05-05T18:36:20.215400Z

it's combined with the :meta

alexmiller 2021-05-05T18:37:20.215600Z

it was included as an option at the end in case you have a large metadata map, you could put it after the main part of the function (using this is very unusual)

alexmiller 2021-05-05T18:37:28.215800Z

most people don't even know that exists

πŸ˜€ 1
2021-05-05T19:15:21.219400Z

i have a question about the deps.edn approach to dependencies. our project has multiple dependencies, one of which happens to exclude another dependency that is otherwise required. when i include both, i start to see a lot of java.lang.RuntimeException: java.lang.NoClassDefFoundError: &lt;&lt;that excluded dependency&gt;&gt; runtime errors. my hypothesis here is that dependency A's exclusion is winning, globally, over dependency B's dependency. is my hypotheses likely? is this typical, or is the inter-dependency interference just idiosyncratic to my set up? is there a workaround?

2021-05-05T19:22:37.219900Z

perhaps it's that my dependency that excludes is high up in the dependency tree

2021-05-05T19:22:56.220100Z

and so the inter-dependency interference is working as intended?

ghadi 2021-05-05T19:23:03.220300Z

why excluding something that appears mandatory?

phronmophobic 2021-05-05T19:23:28.220500Z

If you want a specific version of a library, you should just make it a top level dependency with the version you want.

2021-05-05T19:24:12.220700Z

it's two different third party libraries. in this case, djblue/portal , which excludes org.msgpack/msgpack, and datomic (which, i gather, requires it)

ghadi 2021-05-05T19:25:19.220900Z

can you be more specific about the problem you're having, like a small reproduction case?

ghadi 2021-05-05T19:25:37.221100Z

specifics matter and it's hard to guess

ghadi 2021-05-05T19:26:10.221400Z

is djblue/portal specific bare within your deps.edn?

2021-05-05T19:26:13.221600Z

i can try πŸ™‚. i depend on djblue/portal in ~/.clojure/deps.edn under :deps

ghadi 2021-05-05T19:26:29.221800Z

with an exclusion or not?

2021-05-05T19:27:02.222Z

no exclusion, no. i'm peeking at https://github.com/djblue/portal/blob/master/deps.edn#L4 to come to the conclusion that org.msgpack/msgpack is excluded

seancorfield 2021-05-05T19:27:14.222300Z

Bad idea to have a :deps alias in your user deps.edn file as it will shadow (hide) the :deps alias in your root deps.edn file. Maybe use :dev instead?

πŸ™Œ 1
ghadi 2021-05-05T19:27:59.222500Z

ok -- and datomic is specified in your deps also without any exclusions, correct?

2021-05-05T19:29:21.222700Z

datomic is specified in the deps of the project whose repl i'm invoking, with just one exclusion, but it's unrelated as far as i can tell (`com.amazonaws/aws-java-sdk-s3`)

ghadi 2021-05-05T19:29:37.222900Z

can you paste the coordinate?

2021-05-05T19:29:46.223100Z

`{:exclusions [com.amazonaws/aws-java-sdk-s3] :mvn/version "0.8.102"}`

ghadi 2021-05-05T19:29:55.223300Z

including the datomic part

2021-05-05T19:30:56.223500Z

{org.clojure/clojure       #:mvn{:version "1.10.0"}
 org.clojure/tools.logging #:mvn{:version "0.4.1"}
 com.datomic/client-cloud
 {:exclusions  [com.amazonaws/aws-java-sdk-s3]
  :mvn/version "0.8.102"}
 ch.qos.logback/logback-classic
 {:exclusions [org.slf4j/slf4j-api] :mvn/version "1.2.3"}
 javax.xml.bind/jaxb-api   #:mvn{:version "2.3.0"}
 resauce/resauce           #:mvn{:version "0.1.0"}
 org.clojure/tools.cli     #:mvn{:version "0.3.7"}}

ghadi 2021-05-05T19:31:02.223700Z

thanks

2021-05-05T19:31:26.223900Z

thank /you/ πŸ™‚

2021-05-05T19:33:01.224100Z

> If you want a specific version of a library, you should just make it a top level dependency with the version you want. i don't want it. my dependency does. @smith.adriane

ghadi 2021-05-05T19:33:04.224300Z

what do you need to do to trigger an error, require a datomic namespace? or connect to a cluster?

2021-05-05T19:33:12.224500Z

conn/init-conn

2021-05-05T19:33:24.224700Z

requiring works fine

ghadi 2021-05-05T19:34:16.224900Z

what is that

ghadi 2021-05-05T19:34:27.225100Z

conn/init-conn is not a datomic thing

ghadi 2021-05-05T19:34:41.225300Z

a stacktrace would be helpful

alexmiller 2021-05-05T19:34:51.225500Z

and a clj -Stree from the root project

ghadi 2021-05-05T19:34:56.225700Z

*e when you get an error

phronmophobic 2021-05-05T19:35:06.225900Z

there's no programmatic way to resolve conflicts between dependencies of dependencies. If you figure out which version might be compatible with both dependencies, then you can just add that as a top level dependency.

🀯 1
2021-05-05T19:36:46.226100Z

sorry, my bad. here's the stacktrace:

Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/msgpack/MessagePack
	at com.cognitect.transit.TransitFactory.writer(TransitFactory.java:104)
	at cognitect.transit$writer.invokeStatic(transit.clj:157)
	at cognitect.transit$writer.invoke(transit.clj:139)
	at <http://datomic.client.impl.shared.io|datomic.client.impl.shared.io>$marshal.invokeStatic(io.clj:48)
	at <http://datomic.client.impl.shared.io|datomic.client.impl.shared.io>$marshal.invoke(io.clj:38)
	at <http://datomic.client.impl.shared.io|datomic.client.impl.shared.io>$client_req__GT_http_req.invokeStatic(io.clj:76)
	at <http://datomic.client.impl.shared.io|datomic.client.impl.shared.io>$client_req__GT_http_req.invoke(io.clj:73)
	at datomic.client.impl.shared.Client._async_op(shared.clj:398)
	at datomic.client.impl.shared.Client.list_databases(shared.clj:437)
	at datomic.client.impl.cloud.Client.list_databases(cloud.clj:153)
	at datomic.client.api.async$list_databases.invokeStatic(async.clj:135)
	at datomic.client.api.async$list_databases.invoke(async.clj:129)
	at datomic.client.api.sync.Client.list_databases(sync.clj:91)
	at datomic.client.api$list_databases.invokeStatic(api.clj:131)
	at datomic.client.api$list_databases.invoke(api.clj:125)
	at db.conn_v2$db_exists_QMARK_.invokeStatic(conn_v2.clj:9)
	at db.conn_v2$db_exists_QMARK_.invoke(conn_v2.clj:8)
	at db.conn_v2$init_conn.invokeStatic(conn_v2.clj:14)
	at db.conn_v2$init_conn.invoke(conn_v2.clj:11)
	at db.conn_v2$conn_cache$fn__28471.invoke(conn_v2.clj:36)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.core$memoize$fn__6894.doInvoke(core.clj:6342)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at authentication.interceptors$inject_customer_db$fn__25378.invoke(interceptors.clj:161)
	at clojure.lang.AFn.applyToHelper(AFn.java:154)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:669)
	at clojure.core$apply.invoke(core.clj:662)
	at io.pedestal.interceptor.helpers$before$fn__16276.invoke(helpers.clj:109)
	at io.pedestal.interceptor.chain$try_f.invokeStatic(chain.clj:54)

2021-05-05T19:38:38.226300Z

alexmiller 2021-05-05T19:43:08.226500Z

I'd also be curious of your clj --version

alexmiller 2021-05-05T19:43:40.226800Z

the only version of transit that's getting included is the one via djblue/portal, which is intentionally excluding msgpack

2021-05-05T19:44:09.227Z

~/tract-manager/projects/one-deps-repl(main) $ clj --version
Please install rlwrap for command editing or use "clojure" instead.
~/tract-manager/projects/one-deps-repl(main) $ clojure --version
Clojure CLI version 1.10.3.822

alexmiller 2021-05-05T19:46:22.227200Z

ok, so newest

alexmiller 2021-05-05T19:46:50.227400Z

I think the only way you can reconcile this is by including msgpack as a top-level dep, basically overriding djblue/portal's statement

alexmiller 2021-05-05T19:47:10.227600Z

org.msgpack/msgpack {:mvn/version "0.6.12"}

ghadi 2021-05-05T19:48:16.227800Z

including com.cognitect/transit-clj top-level seems to do the trick

alexmiller 2021-05-05T19:48:24.228Z

that would also work, yes

ghadi 2021-05-05T19:48:29.228200Z

that's probably preferred

ghadi 2021-05-05T19:48:37.228400Z

because it's not just msgpack that's omitted

ghadi 2021-05-05T19:49:00.228600Z

clj -Stree -Sdeps '{:deps {djblue/portal {:mvn/version "0.11.1"} com.datomic/client-cloud {:mvn/version "0.8.102"} com.cognitect/transit-clj {:mvn/version "0.8.313"}}}'

alexmiller 2021-05-05T19:49:29.228800Z

exclusions at the library level are likely to cause these kinds of issues

2021-05-05T19:49:55.229Z

ok! can do

2021-05-05T19:50:47.229200Z

i appreciate the help and the context, very much

2021-05-05T20:30:34.230200Z

What if I want to make a proxy call for a few calls only?

borkdude 2021-05-05T20:50:48.230400Z

Maybe you can unset the system properties using System/setProperty, not sure if that helps

djblue 2021-05-05T21:19:44.230700Z

https://github.com/djblue/portal/releases/tag/0.11.2 will stop excluding transitive deps, didn't realize it would cause problems 😬

πŸ™Œ 1
seancorfield 2021-05-05T21:26:57.231Z

My experience with deps.edn and tools.deps.alpha is that :exclusions are almost never needed β€” unlike with Leiningen/Boot. This is the only exclusion in our entire codebase:

com.walmartlabs/lacinia {:mvn/version "0.35.0"
                           :exclusions [clojure-future-spec/clojure-future-spec]}
and that was needed because Lacinia includes the dependency so it works on pre-Spec versions of Clojure and would conflict with Clojure’s Spec if not excluded (as I recall β€” but we probably ought to verify that is still true).

seancorfield 2021-05-05T21:28:57.232200Z

(yup, looks like we could remove that exclusion now)