This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-15
Channels
- # announcements (1)
- # aws (79)
- # babashka (47)
- # beginners (82)
- # calva (65)
- # cider (27)
- # cljdoc (18)
- # cljs-dev (29)
- # clojure (189)
- # clojure-dev (5)
- # clojure-europe (3)
- # clojure-italy (1)
- # clojure-madison (6)
- # clojure-nl (4)
- # clojure-spec (10)
- # clojure-uk (41)
- # clojured (3)
- # clojurescript (5)
- # clojurex (17)
- # cursive (30)
- # data-science (7)
- # datomic (17)
- # emacs (3)
- # events (6)
- # fulcro (2)
- # funcool (9)
- # graalvm (29)
- # jobs-discuss (3)
- # joker (3)
- # kaocha (6)
- # malli (5)
- # music (6)
- # off-topic (21)
- # reagent (3)
- # reitit (4)
- # rewrite-clj (8)
- # shadow-cljs (49)
- # spacemacs (7)
- # sql (23)
- # tools-deps (15)
- # vim (43)
- # xtdb (19)
@mruzekw you may interested in https://github.com/stediinc/cdk-clj.
Trying to do S3 listing from within of an aws lambda fails for me with aws/api and aws/s3
{:cognitect.anomalies/category :cognitect.anomalies/fault, :cognitect.anomalies/message java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;, :cognitect.http-client/throwable #error {
:cause java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
:via
[{:type java.lang.NoSuchMethodError
:message java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
:at [cognitect.http_client$empty_bbuf invokeStatic http_client.clj 37]}]
:trace
[[cognitect.http_client$empty_bbuf invokeStatic http_client.clj 37]
[cognitect.http_client$empty_bbuf invoke http_client.clj 34]
[cognitect.http_client$on_content$fn__10264 invoke http_client.clj 140]
[clojure.core$update invokeStatic core.clj 6196]
[clojure.core$update invoke core.clj 6188]
[cognitect.http_client$on_content invokeStatic http_client.clj 139]
[cognitect.http_client$on_content invoke http_client.clj 136]
[clojure.lang.Atom swap Atom.java 51]
;; code starting like
(let [s3-listing (aws/invoke s3 {:op :ListObjectsV2 :request
{:Bucket bucket-name
:Prefix files-prefix}})
s3-files (map :Key (:Contents s3-listing))]
(println s3-listing)
which JDK?
and you are aot'ing
and if so with what jdk
Will report a little later
I was compiling with leiningen on java11 openjdk, and Amazon is running java8 openjdk for java lambdas
Once I convinced leiningen to run with java8 for uberjar build the problem seemed to go away
yeah, that's what I would have recommended
there have been some changes in the jdk that affect the compiled method invocation here. I don't remember the details but it is pretty subtle
Any advice is welcome, some parts of the internet suggest a jdk version issue, aws lambda is running java8
The aws-api readme says: > specs which are generated from the source descriptions There's no obvious documentation on how to use these. How do I access these generated specs?
(s/def :cognitect.aws.kinesis/ConsumerStatus #{"DELETING" "CREATING" "ACTIVE"})
enums are thereNot all of them are like that:
(s/def :cognitect.aws.workspaces/WorkspaceState string?)
Reference docs: https://docs.aws.amazon.com/workspaces/latest/api/API_Workspace.html?shortFooter=true> Valid Values: PENDING | AVAILABLE | IMPAIRED | UNHEALTHY | REBOOTING | STARTING | REBUILDING | RESTORING | MAINTENANCE | ADMIN_MAINTENANCE | TERMINATING | TERMINATED | SUSPENDED | UPDATING | STOPPING | STOPPED | ERROR
The generators for these specs also don't work.
(gen/generate (s/gen :cognitect.aws.workspaces.Workspace/DirectoryId))
Execution error (ExceptionInfo) at clojure.test.check.generators/fn (generators.cljc:435).
Couldn't satisfy such-that predicate after 100 tries.
That's a bit harder to solve given the spec is a regex.regex specs is a known problem that @dchelimsky is working on
i'm looking into why (s/def :cognitect.aws.workspaces/ConnectionState string?)
is not an enum
you would think but @dchelimsky tested it and it's about 50/50 from what I recall
Far less than 50/50.
matching meaning the API documentation (non-canonical) and the service descriptor (non-canonical)
If I were to guess what happened: someone tried to hit an API with the library's validation turned on, and a value was rejected because it wasn't in the enum spec
Interesting. A bit surprised someone else is using Clojure & WorkSpaces haha. So then you guys must be storing which specs do not match and overriding with the "open" enum -- string?.
But this one isn't? https://clojurians.slack.com/archives/C09N0H1RB/p1573839150185200
I understand. It's kinda a tricky situation. I'm planning to have functions that operate over certain AWS properties. Having generators generate relevant values is important. Seems like the enum values should be worked into the generated generators.
If the gens for things like ConsumerStatus
always generate a random string it will not hit all the code paths, making the gen test bad. For now I can do something like this for all the enum specs:
(s/def :workspace-info/State
(s/with-gen
:cognitect.aws.workspaces/WorkspaceState
#(gen/one-of [(s/gen #{"PENDING"
"AVAILABLE"
"IMPAIRED"
"UNHEALTHY"
"REBOOTING"
"STARTING"
"REBUILDING"
"RESTORING"
"MAINTENANCE"
"ADMIN_MAINTENANCE"
"TERMINATING"
"TERMINATED"
"SUSPENDED"
"UPDATING"
"STOPPING"
"STOPPED"
"ERROR"})
(s/gen string?)])))
It'd be nice to have something like that build in.@kenny side note: you'll get better feedback (s/describe and s/explain) if you use the s/spec
macro with :gen
than the s/with-gen
function.
Also would be great to have a note in the readme or, even better, next to the enum specs noting why it is specced as an open enum.
Far less than 50/50.