Fork me on GitHub
#datomic
<
2020-01-26
>
frozar04:01:15

Thank you for links, they are really helpful 🙂

1
Sam DeSota07:01:45

Hello, I'm attempting to deploy an :http-direct app via a datomic ion, but for the life of me I can't get past this error when submitting to the endpoint:

No implementation of method: :->bbuf of protocol: #'datomic.ion.lambda.api-gateway/ToBbuf found for class: nil

at core_deftype.clj

Sam DeSota07:01:47

Note, this exact error is mentioned in troubleshooting relating to not returning a valid response from lambda ions, but I'm returning a valid string.

Sam DeSota07:01:40

This is my http-handler

(defn graphql-route [secret query vars]
  (if (is-authorized? secret)
    (let [result (execute orders-schema query vars nil)]
      (json/write-str result))

    (json/write-str {:message "Not authorized"})))

(defn http-handler [req]
  (let [body (-> (:body req) io/reader (json/read :key-fn keyword))]
    {:status 200
     :headers {"Content-Type" "application/json"}
     :body (graphql-route (-> req :headers (get "authorization")) (-> body :query) (-> body :variables))}))

(def app
  (apigw/ionize http-handler))

Sam DeSota07:01:11

Any hints on where this sort of error could be comming from would be much appreciated.

dharrigan08:01:43

Hi, in the email I got about having a starter pro license, there is a link to the EULA - which results in a 404

frozar15:01:42

Hello, I try find find my way through datomic and I still have really basic questions. I have a transactor and a peer server running locally, and I try the following program:

(ns datomic-tuto.core
  (:require
   [datomic.client.api :as d]))

(def cfg {:server-type :peer-server
          :access-key "myaccesskey"
          :secret "mysecret"
          :endpoint "localhost:8998"
          :validate-hostnames false})
(def client (d/client cfg))
(d/delete-database client {:db-name "pet-owners-db"})
When I try to delete a database, I get the following error in REPL:
1. Unhandled java.lang.AbstractMethodError 
   datomic.client.impl.shared.Client.delete_database(Ljava/lang/Object;)Ljava/lang/Object;
                 async.clj:  158  datomic.client.api.async/delete-database
                 async.clj:  150  datomic.client.api.async/delete-database
                  sync.clj:   74  datomic.client.api.sync.Client/delete_database
                   api.clj:  155  datomic.client.api/delete-database
                   api.clj:  146  datomic.client.api/delete-database
                      REPL:   25  datomic-tuto.core/eval17171
                      REPL:   25  datomic-tuto.core/eval17171
             Compiler.java: 7176  clojure.lang.Compiler/eval
             Compiler.java: 7131  clojure.lang.Compiler/eval
                  core.clj: 3214  clojure.core/eval
                  core.clj: 3210  clojure.core/eval
                  main.clj:  414  clojure.main/repl/read-eval-print/fn
                  main.clj:  414  clojure.main/repl/read-eval-print
                  main.clj:  435  clojure.main/repl/fn
                  main.clj:  435  clojure.main/repl
                  main.clj:  345  clojure.main/repl
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   79  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   55  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  142  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  171  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  170  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  748  java.lang.Thread/run
The delete_database method seems to be abstract and I don't understand how it is possible. I use the datomic-pro lib [com.datomic/datomic-pro "0.9.6024"] Any help/hint would be really helpful :)

dharrigan15:01:58

Is delete-database a function of the client, not the datatabase?

dharrigan15:01:04

client/delete-database?

frozar15:01:38

I was checking that and for me it is a function of the client: https://docs.datomic.com/client-api/datomic.client.api.html#var-delete-database

frozar15:01:36

I think that it's legitimate for a client to be able to delete a database

dharrigan15:01:20

but in your source you're invoking it against the db

dharrigan15:01:25

(d/delete-database client {:db-name "pet-owners-db"})

dharrigan15:01:30

d === ref to the db

dharrigan15:01:42

instead of client/....

frozar15:01:30

May be I use a non standard requirement [datomic.client.api :as d]

dharrigan15:01:49

try using client 🙂 if that doesn't work, then <shrug> 🙂

maxt15:01:47

client is what you get back from d/client

maxt15:01:58

Sorry, that's indeed what you def:ed. Looks right to me

frozar15:01:45

Ok, but I must do something wrong, when I try (client/delete-database {:db-name "pet-owners-db"}) I get the error No such namespace: client

maxt15:01:55

The namespace looked right, I also have (require [datomic.client.api :as d])

maxt15:01:22

And (d/delete-database client {:db-name db-name})

marshall15:01:31

In datomic OnPrem only peers can create and delete databases

marshall15:01:41

Clients cannot

marshall15:01:54

This is a difference between onprem and cloud

marshall15:01:40

If you want to create or delete a db with onprem you need to connect a peer to your transactor and do so

marshall15:01:53

Client via peer server cant do that

frozar15:01:46

Ooooh, that's a news, ok, thank you @marshall

marshall15:01:15

See from there down

marshall15:01:15

In particular the peer server part: "The Datomic Peer Server does not create durable-storage databases itself. To use a Peer Server along with a dev storage database you will need to have previously created a database and have a running dev Transactor. "

👍 1
eoliphant15:01:06

Hi I’m experimenting with the analytics support in Cloud, and i’m running into an issue where I get a “failed: Rounding necessary” error from time to time. I thought I’d traced it down to a specific ‘column’, by just adding them one by one to a query. But I then found that, subsequent queries with only that column, didn’t cause the issue

eoliphant15:01:37

so in this case, how can i handle cases where there scale might vary? If I have bigdec attrs, for say :something/money. and some are 123 and others 123.45 ?

marshall16:01:29

Use the largest

marshall16:01:52

It will add 0s to reach that precision

eoliphant15:01:00

sorry, yeah figured that out. thx ! ironically this revealed some bugs in the code where moneytary vals had something othehr than a scale of 2 (or 0)

dharrigan16:01:38

Where would be a good place to recommend updates/corrections to the documentation?

jaret19:01:57

@dharrigan you can drop an email to <mailto:[email protected]|[email protected]> that way it won’t get lost to slack archiving or you can drop a note here.

dharrigan22:01:24

sure. I'll gather my notes 🙂