This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-15
Channels
- # announcements (51)
- # beginners (65)
- # calva (44)
- # cider (6)
- # clara (3)
- # clj-kondo (30)
- # cljsrn (5)
- # clojure (63)
- # clojure-australia (7)
- # clojure-dev (7)
- # clojure-europe (43)
- # clojure-gamedev (1)
- # clojure-nl (6)
- # clojure-uk (7)
- # clojurescript (51)
- # conjure (1)
- # cursive (9)
- # datascript (16)
- # datomic (14)
- # depstar (20)
- # events (1)
- # exercism (17)
- # figwheel-main (6)
- # fulcro (9)
- # graphql (3)
- # gratitude (2)
- # honeysql (4)
- # jobs (7)
- # leiningen (3)
- # lsp (107)
- # meander (7)
- # minecraft (3)
- # off-topic (16)
- # other-languages (4)
- # pathom (4)
- # pedestal (26)
- # practicalli (4)
- # re-frame (3)
- # reitit (7)
- # remote-jobs (1)
- # shadow-cljs (26)
- # tools-deps (67)
- # vim (19)
- # vscode (1)
Can someone explain what’s causing a “Key must be an integer” when attempting to POST on “/iota”? https://github.com/v3gal0g/cybernest-xd/blob/main/src/clj/cybernest_xd/router.clj#L43 https://github.com/v3gal0g/cybernest-xd/blob/main/src/clj/cybernest_xd/journal.clj#L100
Sounds like something in your code is expecting a vector and not a map. Not sure what without seeing the full exception. It could be this: https://github.com/v3gal0g/cybernest-xd/blob/a26dedde3eda6624b3f163c8182bbec53d05f9f0/src/clj/cybernest_xd/router.clj#L47 I'm not sure if :post/:get/etc can accept a map with an :interceptors key. I was under the impression you provide an vector of interceptors directly.
["/iota" {... :post [journal/create-iota!]}]]
hmm, not sure if this works. It throws the same error even as :post [journal/create-iota!] https://gist.github.com/v3gal0g/0615877edc8c81feb3e9a54236c53ec3
There is more to read about the terse syntax you are trying to use here: http://pedestal.io/reference/routing-quick-reference#_terse_syntax My original example seems wrong now. This may work
["/iota" {... :post `journal/create-iota!}]]
;; or
["/iota" {... :post [:create-iota `journal/create-iota!]}]] ;; s.t. :create-iota is a name given to this endpoint
I don't think that is your problem though
The exception is being thrown in an interceptor by this name: :io.pedestal.http.secure-headers/secure-headers
everything is public if that helps https://github.com/v3gal0g/cybernest-xd/
Does it work if you remove that setting? That would indicate that the value of :content-security-policy-settings
you have setup is not right.
hmmm i’d think that would be fine since swagger and everything works… the error is thrown when I attempt to use/test “/iota” With that said i’m rather weak with both clojure and pedestal here.
Try to use
"default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline'"
This is the pedestal default for that value:
"object-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https: http:;"
What about removing the ::server/secure-headers
from your service map and restarting? The error is being thrown when pedestal is trying to build those secure headers so it has to be something related to that
I can't offer much advice around swagger and pedestal. I've not done any real work with the two.
No worries…it works now but i’m not sure whats changed. So i’ll stop here and check the diffs. Thank you though. I believe the issue was around where you mentioned. Something clearly was off.
In case you appreciate the technique, for cases like these I do as follows:
1.- get a stacktrace
2.- use jump-to-definition
3.- strategically place debugging statements (or (assert)
s) across functions described in the stacktrace
4.- take note of the precise place that passed a wrong value and fix it
needs a little bit of IDE/editor mastery but it pays off so well
@vemv sounds good, i’ll put that into practice. In this particular case though I’m not sure because it really didn’t seem to give you anywhere to jump to outside of the route I wanted?
You would have had to jump into the pedestal code itself in this particular case. Your server config was setup, then being interpreted when a request came in, so the original source of the problem was a little difficult to track down.
I would encourage you to look through some of the pedestal code sometime, especially when problems pop up like this. It can be a lot at first, but I usually find it pretty straightforward to read through
@dannyfreeman yeah I have it saved under favorites to skim through from time to time. I actually stopped and briefly went over basics with ring. I SHOULD spend more time there but I’m a glutton for pain.
@vemv sounds good, i’ll put that into practice. In this particular case though I’m not sure because it really didn’t seem to give you anywhere to jump to outside of the route I wanted?
I am running pedestal/ion-provider
to support a direct http ion. I am trying to debug the CORS :io.pedestal.http/allowed-origins
configuration and I am therefore interested in the log output written by
(log/info :msg "cors request processing"
:origin origin
:allowed allowed)
but I cannot seem to find it in cloudwatch logs;
https://docs.datomic.com/cloud/ions/ions-monitoring.html#java-logging
seems to imply that log/info
just doesn't get written to cloudwatch events; is that true?
would I normally expect the http-direct logs to be written direction into the datomic
loggroup?@dannyfreeman yeah I have it saved under favorites to skim through from time to time. I actually stopped and briefly went over basics with ring. I SHOULD spend more time there but I’m a glutton for pain.