Fork me on GitHub
#datomic
<
2020-10-13
>
vncz03:10:37

What error is this? Why am I only limited to use find-rel ?

kenny05:10:27

Datomic client API doesn't support all the find specs that the peer API supports. See https://docs.datomic.com/cloud/query/query-data-reference.html#find-specs for what is supported.

vncz12:10:18

@U083D6HK9 So shall I use the peer server in case I'd like to do such query?

vncz03:10:58

This is the query I am trying to run

marshall12:10:11

@vincenz.chianese change your find to: :find ?name ?surname

marshall12:10:27

then you can manipulate the collection(s) returned in your client application if necessary

vncz13:10:22

Yeah, I was trying to avoid such boilerplate per each query @marshall

vncz13:10:54

Because I'm receiving something like [[{"name": "name", "surname": "surname"}]]

vncz13:10:08

That's kind of weird as structure (although I am sure there's a reason for that

marshall13:10:28

you could pull in the find

marshall13:10:23

i.e. :find (pull ?id [:name :surname])

vncz13:10:27

I tried that but I think that still gave me a weird structured result

vncz13:10:53

Indeed: [[{"person/name":"Porcesco","person/surname":"Gerbone"}]]

vncz13:10:01

That's the same result I'm regularly getting using the regular query

Sven19:10:16

After recently changing a backend stack from AWS Appsync -> AWS Lambda -> Datomic ions -> to AWS Appsync -> HTTP direct -> API Gateway -> Datomic ions I am now getting errors like

Syntax error compiling at (clojure/data/xml/event.clj:1:1)
java.lang.IllegalAccessError: xml-str does not exist

Syntax error compiling at (clojure/data/xml/impl.clj:66:12).
java.lang.IllegalAccessError: element-nss does not exist

Syntax error compiling at (******/aws/cognito.clj:20:38).
java.lang.RuntimeException: No such var: aws/invoke
They happen every now and then with seemingly no way to reliably reproduce them and never happened when calling ions via Lambdas. I have updated ion, ion-dev, client api, datomic storage and compute to latest as of current date with no effect. Does anyone have ideas where to look for hints or what could be a cause for such behaviour?

Sven19:10:50

There is one major change compared to the Lambda configuration - I am now resolving functions in other namespaces based on routes. Could this have any effect and if so then why? There are no errors with resolving these functions tough.

Alex Miller (Clojure team)19:10:06

those all look like they could be a case of not having the expected version of a dependency (OR that it's asynchronously loading and you're seeing partial state)

Alex Miller (Clojure team)19:10:19

when you resolve functions, how are you doing it?

Alex Miller (Clojure team)19:10:39

I would recommend using requiring-resolve

Sven19:10:48

I parse a string to a symbol and then resolve it e.g. (when-let [f (resolve 'app.ions.list-something/list-something)] (f args))

Alex Miller (Clojure team)19:10:41

so you're not ever dynamically loading namespaces?

Alex Miller (Clojure team)19:10:36

I mean, where does 'app.ions.list-something coming from? is that a dynamic value?

Sven19:10:46

I get a string from a route e.g. list-something and then I convert it into a symbol app.ions.list-something/list-something and then resolve it. Just like in the datomi cion starter example https://github.com/Datomic/ion-starter/blob/7d2a6e0bda89ac3bb4756501c3ada3d1fbc80c1a/src/datomic/ion/starter.clj#L26

Sven19:10:30

Fixed my examples 😊. I guess I’ll try requiring-resolve .

Sven19:10:40

and I am also requiring the namespace dynamically just like in that example (-> ion-sym namespace symbol require)

Sven19:10:23

This is my http direct handler fn

(defn handler
  [{:keys [uri] :as req}]
  (try
    (let [arg-map (-> req parse-request validate authenticate)
          {:keys [ion-sym]} arg-map]
      (-> ion-sym namespace symbol require)
      (let [ion-fn (resolve ion-sym)]
        (when-not ion-fn
          (throw (ex-info ...)))
        (ion-fn arg-map)))
    (catch ....)))

Alex Miller (Clojure team)20:10:10

yeah, I would strongly recommend requiring-resolve - it uses a shared loading lock

3
Sven20:10:25

I changed resolve -> requiring-resolve . The issue still persists with the exception that now only specific namespaces fail and in almost 100% of cases. What makes them different is that they implement cognitect aws api and fail at cognitect/aws/client.clj 😕

Alex Miller (Clojure team)20:10:17

what does "they implement cognitect `aws api` " mean? they == what? implement == what?

Alex Miller (Clojure team)20:10:54

aws api does do some dynamic loading but should be doing safer things already

Sven21:10:10

If I resolve and execute a symbol that uses cognitect.aws.client.api to invoke an operation on an AWS service then I always get Syntax error compiling at (cognitect/aws/client.clj…). I added (:require [cognitect.aws.client.api]) to the handler namespace and seem to get no syntax error compiling at errors anymore. I guess it’s a fix for now.

Alex Miller (Clojure team)21:10:29

yeah, don't know off the top of my head but that would have been my suggestion

3
Brandon Olivier22:10:48

Does the Datomic client lib support fulltext ?