Fork me on GitHub
#pedestal
<
2021-10-14
>
fabrao00:10:27

is there any way to turn off the pedestal org.eclipse.jetty Debug messages from timbre?

fabrao00:10:30

I tried using com.fzakaria/slf4j-timbre and use :ns-blacklist ["org.eclipse.jetty.*" "io.pedestal.*" "com.walmartlabs.lacinia.*"] but it didn´t work

Ivar Refsdal10:10:04

What version of timbre and slf4j-timbre are you using? :ns-blacklist is deprecated? I am using :min-level like so:

{:min-level       [[#{"*"} :info]
                                       [#{"*"} :warn]]}
for passing to timbre 5.1.0 and using slf4j-timbre 0.3.20

Ivar Refsdal10:10:12

which works fine

ghaskins01:11:30

I ran into a problem where the recent log back-classic broke, resulting in slf4j based Java code, like jetty and Kafka disregarding timbre whitelists

ghaskins01:11:24

The solution is to remove the exclusion on logback-classic for the API, then all is well

ghaskins01:11:37

Not sure this is same issue as you are facing

v3ga03:10:44

Can someone point me in the right direction. I’m trying to send a POST from my client and earlier today I did manage to send my :post field and get it to save to the database. At the moment that’s not working and i’m trying to figure out what’s going on and if this is an issue with my backend or frontend(both)? https://gist.github.com/v3gal0g/273cf964b423bfd7719d05d0722e058b

v3ga03:10:09

The response is nil, I see that. But i’m confused as hell because it did indeed write to my DB earlier. Now it triggers the creation of an empty row so I at least know it’s hitting that route properly, i’m just not catching the data.

Lennart Buit05:10:50

Your log contains an exception. So presumably something goes wrong in your handler / pedestal ends up down the error functions of your interceptors

Lennart Buit05:10:25

The exception says you are calling a map (which is legit), but don’t end up passing arguments. I think that’s somewhere else (as in, not in your gist)

Lennart Buit05:10:33

(This is allowed: ({:a 1} :a), but this is not ({:a 1}))

👍 1
v3ga05:10:07

Hmm, I do have the project public. Oh! That ghetto hack to pass in the architect id huh? https://github.com/v3gal0g/cybernest-xd

souenzzo15:10:41

On pedestal context we can find "content-type" "application/transit+json" Is it really transit? If it is transit, you should access :transit-params (that is nil, in this case) If is not transit, you shuold use content-type application/json You probably will solve this on the client. The server looks fine

souenzzo15:10:37

This should fix

(defn send-message! [fields]
  (-> (js/fetch "/iots"
        #js{:method  "POST"
            :headers #js {"content-type" "application/json"}
            :body    (js/JSON.strinfigy (clj->js @fields))})
    (.then (fn [res] (.json res)))
    (.then #(.log js/console (str "response: " %)))
    (.catch #(.error js/console (str "error: " %)))))

👍 1
souenzzo15:10:27

I have a small reagent+pedestal didactic project, with just ~300 LOC It uses JSON to communicate in the API, really similar to your setup. I'm still writing the tutorial (it is incomplete) but it serves as a reference 🙂 https://github.com/souenzzo/atemoia

v3ga15:10:20

@U2J4FRT2T Thanks! Taking a look now… yeah i’m just now learning how to read the output and noticed I was trying to access something that doesn’t exist.

v3ga15:10:36

js/fetch is really interesting. I’ve never seen that before. That’s preferred over cljs-ajax?

souenzzo15:10:31

I really like the browser API's. I (personally) don't see many value in these "magical easy ajax libraries" https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

👍 1
v3ga15:10:35

Yeah, I won’t argue that. I’m just now starting to learn JS so I know what’s actually going on. I’ll adopt this practice.

souenzzo16:10:00

feel free to send me any questions 🙂

👍 1
Lennart Buit16:10:52

Mdn is your friend in learning browser tech (html/css/js + stdlib)

👍 1
v3ga01:10:09

Ok sorry, I still have some confusion. I’m able to write to the database now from my client but it still throws a 500 and complains. What am I missing there because my map definitely is getting passed in to insert-iota https://github.com/v3gal0g/cybernest-xd/blob/main/src/clj/cybernest_xd/db.clj#L133 clojure.lang.ExceptionInfo: clojure.lang.ArityException in Interceptor :cybernest-xd.db/insert-iota - Wrong number of args (0) passed to: clojure.lang.PersistentHashMap

souenzzo11:10:31

This error: `Wrong number of args (0) passed to: clojure.lang.PersistentHashMap db.clj` Is always result of something like (m) or (apply m []) where m is a hash-map I think that in this case, is related to the #spy/p

❤️ 2
v3ga11:10:03

@U2J4FRT2T wow, that absolutely was it… thank you!