Fork me on GitHub
#datomic
<
2020-06-25
>
tatut17:06:38

I see datomic cloud accepts frequencies as an aggregate if :find but I don’t see it documented, is that supported or some undefined behaviour? EDIT: doesn’t seem to return what I’d expect… weird that it’s accepted

favila18:06:50

I think you are accidentally using it as a custom aggregate: https://docs.datomic.com/on-prem/query.html#custom-aggregates

favila18:06:28

I think no-namespace symbols are interpreted as in clojure.core, so it happens to work

tatut18:06:53

I haven’t seen anything in cloud docs about custom aggregates

favila18:06:51

because it’s cloud (query is running on a different process than yours) there’s usually stuff you need to do to expose your fn to the query code

favila18:06:07

but again, I think because it’s clojure core it just accidentally works

favila18:06:24

I can also use datomic.api functions in a client query when using peer-server

tatut18:06:07

but it didn’t work… it’s not returning what frequencies should

favila18:06:28

what is it returning?

tatut18:06:43

it didn’t get all the values I was expecting it to get… I’ll try it out again later if it should work

tatut18:06:41

Perhaps I’m not understanding the cloud docs as they don’t mention the custom aggregates

favila18:06:54

This is what I get:

favila18:06:02

(dc/q '[:find (frequencies ?b)
         :with ?a
         :in $ [[?a ?b]]]
       db [[:a :A] [:a :Z] [:b :A] [:b :F]])
=> [[{:F 1, :A 2, :Z 1}]]

favila18:06:32

seems right?

tatut18:06:43

that looks right

tatut18:06:22

my frequencies is only getting one item so the result is always a mapping of {the-one-value 1}

tatut18:06:03

but thanks for the help, I’ll continue investigating later

favila18:06:00

if you don’t use :with, that is expected

favila18:06:11

the result is a set, thus every item occurs once

jeff tang19:06:36

hi! is it possible to retract a reverse-loookup attribute-value? e.g. [:db/retract 100 :_children 200]

favila19:06:06

[:db/retract 200 :children 100]

favila19:06:43

it’s not possible with an underscore attribute

👍 3
favila19:06:50

you have to reverse the terms

JAtkins19:06:47

Is it possible to respond to http ion requests with multiple "Set-Cookie" headers? My response using just ring wrap cookies looks like this:

"Headers": {
            "Content-Type": "application/transit+json; charset=utf-8",
            "Set-Cookie": [
                "jwt-token=eyJraWQiOiJOM0pRej--retracted--sdfw;Path=/;HttpOnly;SameSite=Strict"
            ]
        }
This works in ring since for seqs the header is translated to this:
Content-Type: application/transit+json; charset=utf-8
Set-Cookie: jwt-token=eyJraWQiOiJOM0pRej--retracted--sdfw;Path=/;HttpOnly;SameSite=Strict
However the ion spec only allows maps of string->string to be returned, and there is no way to set multiple cookeis with only one line in the header.

JAtkins20:06:43

Genius - thanks!

adamtait07:06:35

This fix works great on Ions with Solo deploy or via Lambda, but it’s failing for me with http-direct.

{
   :status 200
   :headers {
             "content-type":"application/json",
             "Set-cookie":"b=cookie",
             "set-cookie":"a=cookie"}
   :body "{\"data\": \"stuff\"}"
   }
This response from the http-direct handler results in the HTTP response:
< HTTP/2 200
< content-type: application/json
< content-length: 264
< date: Sun, 28 Jun 2020 07:30:54 GMT
< x-amzn-requestid: c3bc8a56-c0bf-41d7-b6b3-24292a2b6509
< x-amzn-remapped-content-length: 264
< set-cookie: b=cookie
< x-amz-apigw-id: O1APLEtPIAMFkGw=
< x-amzn-remapped-server: Jetty(9.4.24.v20191120)
< x-amzn-remapped-date: Sun, 28 Jun 2020 07:30:53 GMT
< x-cache: Miss from cloudfront
… only a single ‘set-cookie’ header when received by the client.

adamtait07:06:51

I have also tried different variations of multiValueHeaders (which is supported by API Gateway) but the Ions HTTP direct wrapper seems to ignore those. Would love to hear if anyone else has seen this issue or worked around it (or if it really is a bug)!

souenzzo11:06:01

I do not use or recommended this CaSE sensitive solution. I just join the cookies with ;

adamtait01:06:07

@U2J4FRT2T are you suggesting this?

:headers { "set-cookie": "a=cookie; b=cookie" }
I wasn’t able to find any documentation on combining multiple cookies in the same header but I tried it anyways and found that browsers ignore the 2nd cookie (`b=cookie` in this example).

JAtkins01:06:49

That’s part of the browser spec. I tried that at first. A new line is required for every cookie. Maybe a \n is needed?

adamtait20:06:11

Thanks for the idea! I wasn’t able to get \n to work. I posted the header inconsistency (between :lambdas and :http-direct to the datomic forum). Hopefully someone from the Datomic team will comment. https://forum.datomic.com/t/inconsistency-between-lambdas-http-direct-multiple-headers/1506

👍 3
Pedro Silva20:06:13

Hello, I am executing the split stack process to be able to upgrade our Datomic version as described in: https://docs.datomic.com/cloud/operation/split-stacks.html#delete-master After start the delete process in CloudFormation we get an error as you can see in the image. Someone can help us to solve this problem and be able to continue the process? Thank you.

souenzzo00:06:08

One year ago I deployed a datomic-ions stack After fail 3 times in row I decided to not try updates anymore. Im really sad to see that they still fail at updates

😐 3