Ask questions on the official Q&A site at https://ask.datomic.com!
vncz 2020-10-13T03:41:37.458Z

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

vncz 2020-10-13T12:45:18.459Z

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

vncz 2020-10-13T03:41:58.458300Z

This is the query I am trying to run

kenny 2020-10-13T05:08:27.458600Z

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.

joshkh 2020-10-13T09:52:29.458800Z

huh, thanks for pointing that out. i thought i tried that... sure enough nil to non-nil works. thanks!

vncz 2020-10-13T12:45:18.459Z

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

marshall 2020-10-13T12:57:11.459500Z

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

marshall 2020-10-13T12:57:27.459900Z

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

vncz 2020-10-13T13:29:22.460300Z

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

vncz 2020-10-13T13:29:54.460900Z

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

vncz 2020-10-13T13:30:08.461400Z

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

marshall 2020-10-13T13:33:28.461700Z

you could pull in the find

marshall 2020-10-13T13:34:23.462200Z

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

vncz 2020-10-13T13:43:27.462600Z

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

vncz 2020-10-13T13:50:53.462800Z

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

vncz 2020-10-13T13:51:01.463100Z

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

Sven 2020-10-13T19:07:16.465200Z

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?

Sven 2020-10-13T19:27:50.465900Z

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.

alexmiller 2020-10-13T19:29:06.466600Z

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)

alexmiller 2020-10-13T19:29:19.466900Z

when you resolve functions, how are you doing it?

alexmiller 2020-10-13T19:29:39.467300Z

I would recommend using requiring-resolve

Sven 2020-10-13T19:31:48.469100Z

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))

alexmiller 2020-10-13T19:32:41.470Z

so you're not ever dynamically loading namespaces?

alexmiller 2020-10-13T19:33:36.470500Z

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

Sven 2020-10-13T19:35:46.472100Z

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

Sven 2020-10-13T19:40:30.474900Z

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

Sven 2020-10-13T19:42:40.475700Z

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

Sven 2020-10-13T19:46:23.476400Z

This is my http direct handler fn

(defn handler
  [{:keys [uri] :as req}]
    (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 ....)))

alexmiller 2020-10-13T20:05:10.477300Z

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

Sven 2020-10-13T20:48:25.481300Z

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 😕

alexmiller 2020-10-13T20:57:17.482100Z

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

alexmiller 2020-10-13T20:58:54.483300Z

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

Sven 2020-10-13T21:16:10.486400Z

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.

alexmiller 2020-10-13T21:35:29.487100Z

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

Brandon Olivier 2020-10-13T22:53:48.488100Z

Does the Datomic client lib support fulltext ?