Fork me on GitHub
#datomic
<
2018-10-18
>
stijn13:10:57

I have the following code for an API Gateway web ion:

stijn13:10:08

(defn ring-handler
  [req]
  (do
    (cast/dev {:msg "RequestLog" ::request req})
    (handler req)))

(def ion-handler
  "API Gateway web service for the FMS API"
  (apigw/ionize ring-handler))

stuarthalloway13:10:24

@U0539NJF7 use cast/event. "NOTE Configuring a destination for cast/dev when running in Datomic Cloud is currently not supported." -- https://docs.datomic.com/cloud/ions/ions-monitoring.html

stijn13:10:11

ok, I totally misunderstood that sentence 😄

stijn13:10:35

although the handler generates a response, I cannot see any message with the RequestLog in Cloudwatch

stijn13:10:15

should I do something special to get these logged?

stijn13:10:35

is it possible that the Content-Length header gets stripped away somewhere between API Gateway - Lambda - ionize? Because I'm definitely sending it, but it doesn't arrive on the ion function as a request header.

jeff.terrell14:10:57

Is this a good place to mention broken links on the Datomic website?

jeff.terrell17:10:33

Well, before I lose track of it, I'll mention it here. The first item under "Getting Started" in the FAQ [1] links here [2] and shows a "page not found" page. [1] https://www.datomic.com/cloud-faq.html#getting-started [2] https://docs.datomic.com/cloud/getting-started/get-datomic.html

jeff.terrell14:10:38

Is it true, as this Hacker News comment states, that Datomic Free Edition does not support the client API? https://news.ycombinator.com/item?id=16169118

jeff.terrell17:10:06

Ah, I finally found it, after searching for a while: > The Datomic Free transactor is limited to 2 simultaneous peers and embedded storage and does not support Datomic Clients. https://www.datomic.com/get-datomic.html

eraserhd14:10:40

So, what happens if we excise history from a database? Will the log have a squashed transaction? Will the log not show the history at all?

val_waeselynck16:10:28

By «excise history», do you mean "excise all retracted datoms"?

stuarthalloway16:10:23

Hi @U0ECYL0ET "The resulting index (and all future indexes) will no longer contain the datoms implied by the excision predicate(s). Furthermore, those same datoms will be removed from the transaction log." -- https://docs.datomic.com/on-prem/excision.html

eraserhd13:10:37

Thanks! AFAICT from those docs, nothing in excision allows targeting only retracted datoms. Is that an omission in the docs?

jeff.terrell17:10:19

In the solo topology of Datomic Cloud, I can still create more than one database (i.e. with d/create-database), right?

marshall17:10:59

@jeff.terrell definitely

👍 4
🆗 4
kenny18:10:07

Why am I getting this exception trying to transact some schema?

(let [conn (d/connect client {:db-name "foo"})]
  (d/transact conn {:tx-data [#:db{:valueType :db.type/instant, :cardinality :db.cardinality/one, :ident :session/last-used-on}]}))
clojure.lang.ExceptionInfo: Value of :db.install/attribute must be in :db.part/db partition, found :session/last-used-on
The db was just created and is completely empty.

kenny18:10:44

I am running Datomic Cloud 441-8505 production topology and com.datomic/client-cloud {:mvn/version "0.8.63"}.

kenny18:10:01

Strangely if I move :db/ident to be the first value in the map, the transaction works:

(let [conn (d/connect client {:db-name "foo"})]
  (d/transact conn {:tx-data [#:db{:ident :session/last-used-on :valueType :db.type/instant, :cardinality :db.cardinality/one}]}))
=>
{:db-before {:database-id "ae464fcb-0bc3-48f3-b3a4-3c8e9eff1d5a",
             :db-name "foo",
             :t 3,
             :next-t 4,
             :type :datomic.client/db},
 :db-after {:database-id "ae464fcb-0bc3-48f3-b3a4-3c8e9eff1d5a",
            :db-name "foo",
            :t 4,
            :next-t 5,
            :type :datomic.client/db},
 :tx-data [#datom[13194139533316 50 #inst"2018-10-18T18:08:00.642-00:00" 13194139533316 true]
           #datom[64 10 :session/last-used-on 13194139533316 true]
           #datom[64 40 25 13194139533316 true]
           #datom[64 41 35 13194139533316 true]
           #datom[0 13 64 13194139533316 true]],
 :tempids {}}
Relying on the order of keys in a map seems like a bad practice.

marshall18:10:08

@kenny put the db/ident first

marshall18:10:11

it’s a bug

marshall18:10:21

i’ll pass it along

kenny18:10:32

Yuck. Ok thanks.

favila18:10:52

yeah there's some order-dependence gotchas in schema-creation

favila18:10:27

lines 123-134

favila18:10:39

the "install" assertions (which are implicit nowadays) must occur after the constraints they check

jeff.terrell20:10:02

I'm getting the ExceptionInfo Forbidden to read keyfile error when I (d/create-database client {:db-name "test"}). The troubleshooting page gives this solution: > Ensure that you have sourced the right credentials with all necessary permissions. Can somebody unpack that a little? I get the notion of AWS credentials, and I have the access key and secret for a user with all IAM permissions in ~/.aws/credentials. So presumably something else is wrong. What specifically does 'sourced the right credentials' mean?

marshall20:10:25

is it in a profile in your creds file?

jeff.terrell20:10:35

It's in the default profile.

marshall20:10:51

export AWS_PROFILE=default

marshall20:10:54

in your environment

marshall20:10:08

or whatever os equivalent is ^

jeff.terrell20:10:18

The environment that's running the datomic-socks-proxy <stack-name> process?

marshall20:10:21

usually default gets grabbed automatically

marshall20:10:34

the one that runs the socks proxy script needs it

marshall20:10:43

but so does the env that you’re using to connect from

jeff.terrell20:10:17

OK, interesting. I'm launching from cider, and I'm not sure what's in that environment. But that's enough for me to go on, thanks!

marshall20:10:56

yeah, not sure how you configure system envars in cider specifically, although exporting the envars before you start emacs should do it

jeff.terrell20:10:03

By the way, I don't think I missed that anywhere in the Datomic Cloud setup instructions, nor was it listed on that 'troubleshooting' entry. That might be worth adding for people like me in the future. simple_smile

jeff.terrell20:10:32

And/or default the AWS_PROFILE lookup to default.

marshall20:10:33

you have several optoins

marshall20:10:50

you can pass the :profile to the client in the connection map

marshall20:10:55

or you can use system-level stuff

jeff.terrell20:10:19

Gotcha, so I did miss that…my bad. simple_smile

kenny20:10:01

This section of the Ion docs says https://docs.datomic.com/cloud/ions/ions-tutorial.html#sec-5-3 > - Under your API in the left side of the UI, click on the bottom choice Settings. > - Choose Add Binary Media Type, and add the */* type, then Save Changes. Why do I need to do this? Will something not work if I skip this step?

stijn08:10:07

yes, I forgot that, and body content was not properly encoded/decoded.

jeff.terrell20:10:43

@marshall - Sorry, I'm still struggling here. I did export AWS_PROFILE=default and restarted my datomic-socks-proxy process. Then I did the same with my REPL. I can confirm that (System/getenv "AWS_PROFILE") returns "default", but I still get the Forbidden to read keyfile exception. (I also read the docs you linked me to, but didn't see anything amiss.) Is there something else I might be missing?

jeff.terrell20:10:19

Ah, figured it out. Apparently the ~/.aws/credentials file can't have comments. When I manually specified a :creds-profile value to the d/client call, that gave me a sufficiently explanatory error message to figure that out. (Or maybe the error was still on d/create-database, I don't remember now.) The regular aws command tolerates comments in ~/.aws/credentials just fine. Is this a bug?

jeff.terrell20:10:02

(Also, the regular aws command uses the default profile if AWS_PROFILE is not set, which is another way I was surprised at the behavior of Datomic, FWIW.)

marshall21:10:19

Datomic uses the default credentials provider in the java SDK

marshall21:10:55

it’s possible that behaves differently than version(s) of the aws CLI

marshall21:10:20

Datomic never reads your ~/.aws/credentials file directly - that is always done by the AWS SDK

🆗 4