This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-29
Channels
- # babashka (54)
- # beginners (24)
- # biff (23)
- # calva (14)
- # catalyst (4)
- # cider (20)
- # clj-kondo (17)
- # clojure (65)
- # clojure-europe (14)
- # clojure-norway (177)
- # clojure-uk (1)
- # clojurescript (11)
- # core-typed (4)
- # cursive (10)
- # datomic (39)
- # emacs (21)
- # gratitude (33)
- # honeysql (8)
- # hyperfiddle (57)
- # introduce-yourself (7)
- # jobs (5)
- # leiningen (17)
- # lsp (6)
- # meander (3)
- # missionary (5)
- # pathom (2)
- # polylith (4)
- # re-frame (7)
- # releases (2)
yes, I think it's a JVM limitation. Why don't you use babashka.http-client which uses java.net.http which is more modern?
Partly because of handling :insecure. I don't see any examples in the docs and when I look in the api I find it difficult to understand what I am supposed to do with the API calls, where the lite client is obvious.
I think I am correct that I need to create a client first and then make the call, but I don't see this in the docs.
I thought the call below would give me the insecure call but it does not:
(ns example.core
(:require [babashka.http-client :as httpc]))
(httpc/request
{:uri url
:method :patch
:ssl-context (httpc/->SSLContext :insecure)
:body content
:accept :json
:headers {"Version" version}
:content-type :json
:oauth-token token
:throw-entire-message? true}
@U4C3ZU6KX Why didn't you just ask? I updated the docs to make that part clearer: https://github.com/babashka/http-client#custom-client
This isn't correct:
(httpc/->SSLContext :insecure)
You need to pass a map:
(httpc/->SSLContext {:insecure true})
:accept :json
also isn't an option in babashka.http-client, you need to write {:headers {:accept "application/json"}}
Sorry to keep asking - how does oauth 2 work with the http-client. I can only see basic auth in the docs, unless I am missing something
http request are basically nothing but sending data like a body and headers. oauth2 is not something that happens on the level of http requests, but rather, is built on top of that
were you using this with clj-http-lite? https://github.com/clj-commons/clj-http-lite/blob/70c34e4f8d5abb5f68e3e94441f2dadd819c4f11/src/clj_http/lite/client.clj#L252
Thanks, Sometimes the libraries look after you to the point that you don't have to think about the underlying functionality. Now I understand that the babashka.http is not that way I am happy.
Hi everybody. A quick report of my problems trying to install babashka from the release zip on a (slow, annoying) windows vm. A few unexpected hiccups:
• MS Edge on my VM can’t open the list of files in github releases pages. Also doesn’t scroll to the #installing
anchor on the babashka README in github. Fixed by installing firefox. 😕 Not really a babashka issue but still surprising given that github is owned by Microsoft.
• Apparently bb.exe
needs VCRUNTIME140_1.dll
which is in something called “https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170” and can be downloaded from the very respectable looking url
• Then, running a babashka project with deps fails with Exception in thread "main" java.lang.Exception: Couldn't find 'java'. Please set JAVA_HOME.
I did not expect that I needed to have Java installed in order to run babashka. Maybe something weird with my dependencies or is this expected behaviour?
https://gist.github.com/joodie/6eb06be4d39e7ab5ddc48cc677714243
Can you please limit the output of your message to a gist or so to not flood this channel?
Better?
Yes, graalvm binaries rely on the c++ redistributable. This is very common for Windows programs
Babashka uses Java for fetching dependencies. If you have any dependencies in bb.edn
then it will invoke https://github.com/borkdude/deps.clj (which uses #tools-deps) to fetch them
Ah ok, so if I have the dependencies available locally it should not need Java? I’m trying to create a project with a few CLI commands + configuration and I want it to be as easy to use as possible. Target audience is technically minded people / developers who don’t necessarily have or want any Java or Clojure experience. Maybe I should look into https://github.com/babashka/babashka/wiki/Self-contained-executable
You can produce an uberjar from your CLI and then install it via #C0400TZENE7. This should not require a JVM
Oh that’s pretty nice. Does bbin require babashka or is that included in the installation?
good to know tb
thanks!
I'd recommend Windows users to use scoop.
scoop bucket add scoop-clojure
scoop install bbin
How to get length of string with babashka? This won,t work: (count "a b c") I get this message: java.lang.Long cannot be cast to clojure.lang.IFn
Do you have an extra pair of parentheses around that maybe?
I have (count "abc") in a try statement just to test out and it doesn,t work. There's no extra ()
(try
(let [
s "maximum printing width for this tape is "
]
(count "a b r")
)
(catch Exception e (println (str (.getMessage e) "..")))
might be missing a closing paren
(try
(let [s "maximum printing width for this tape is "]
(count "a b r"))
(catch Exception e (println (str (.getMessage e) ".."))))
=> 5
I think I found. Seems like using clojure.core/count works for some reason
Yes this was it! I named a variable count... that was a bad idea
Thanks a lot
Shadows are an unfortunate but frequent source of confusion.