Fork me on GitHub
#datomic
<
2018-10-30
>
joshkh12:10:27

has anyone successfully deployed a CORS enabled api gateway for datomic ions? it's doing my head in. setting the API's Binary Media Types to */* returns my edn/json/transit as expected but breaks CORS. removing */* fixes CORS but all responses come back base64 encoded.

joshkh12:10:48

I've dumbed it all down to json, the gateway's default:

(defn test-public-handler
  "A test handler"
  [{:keys [headers body]}]
  {:status  200
   :headers {"Content-Type" "application/json"
             "Access-Control-Allow-Origin" "*"}
   :body    (json/write-str {:test 123})})

stijn12:10:11

I'm trying to setup AWS Codebuild for continuous integration of ions but can't get ion push to work. Getting the following error: "VPC endpoints do not support cross-region requests (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: B45398A68E31CD5C; S3 Extended Request ID: ZKoYFM1MHiGru6sw5tyy3nVslwFKbnkVXp4PU4ASWRKjbzMzKiufyZWLOFSJhyHDQ2yKybhj/3g=)"

stijn12:10:24

anyone any experience with this?

souenzzo14:10:05

datomic-peer throws a NPE from datomic.db.ProcessInpoint.inject when I try to (d/with db [{nil "value"}]) by trying to call (namespace nil)

Joe Lane15:10:29

@stijn it sounds to me like codebuild doesn’t have the right role to push.

stijn15:10:25

@joe.lane to try out, I gave it an assumed role with all permissions in the policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "*",
            "Resource": "*"
        }
    ]
}

stijn15:10:49

I think it has something to do with downloading dependencies from <s3://datomic-releases-1fc2183a/maven/releases/>

Joe Lane15:10:09

Is codebuild in a different region from your system?

Joe Lane15:10:45

Interesting problem, unfortunately I don’t have any answers…

stijn15:10:58

yeah, I saw that too, but until I know what is the exact problem, it's difficult to start looking for solutions in the VPC world of AWS 🙂

Sal17:10:56

I’m having trouble writing a transaction to add an entity to an existing one to many relationship in datomic … something like this is failing me:

Sal17:10:05

Can someone help me or point me to a resource on how to add to a ref attribute that has cardinality many?

joshkh17:10:07

are you getting an error somewhere?

joshkh17:10:46

maybe try wrapping the value of :user/docs in a vector? :user/docs [{:doc/id (d/squuid) :doc/name "Foo"}]

marshall18:10:35

@fuentesjr 2 things. 1) what @joshkh said ^, cardinality/many assertions need to be in a vector, and if you’re asserting a lookup ref, which is a vector itself, you’ll need 2 vectors (i.e. [[:doc/id 12345]]) 2) you’re mixing list and map form in your transaction. I would use the map form: {:db/id 17592186045419 :user/docs [{:doc/id (d/squuid....]}

Sal18:10:42

:message “:db.error/not-an-entity Unable to resolve entity: #:barber{:id #uuid \“5bd89d31-4fcf-4ce1-b82b-15ef047a8d6e\“, :name \“Foo\“} in datom [17592186045419 :barbershop/barbers #:barber{:id #uuid \“5bd89d31-4fcf-4ce1-b82b-15ef047a8d6e\“, :fname \“Foo\“}]

Sal18:10:33

Ok let me try your suggestions

joshkh18:10:33

@fuentesjr not a technical explanation, but whatever values you transact in the one-to-many vector are treated as additions, so you don't need to include previous values. pretty sure it's a Set in the background.

joshkh18:10:07

becomes obvious once you get the hang of it, but a slight gotcha if you're used to setting & replacing values.

Sal18:10:25

@joshkh @marshall Thank you guys. I was able to commit the transaction after wrapping the doc entity in a vector and sticking to the map form

joshkh18:10:57

map form is the way to go. 💪

Sal18:10:36

By the way, if I wanted to remove one of those documents at some point, would I retract the document?

joshkh18:10:00

for your one-to-many relationship you'd retract in the same way: supply a vector of ref id's to remove from the collection

Sal18:10:49

and how do i specify it’s a retract in map form?

Sal18:10:57

or would i have to use the list form?

marshall18:10:04

retract is a list-form thing

marshall18:10:13

unless you’re using the built-in retractEntity function

marshall18:10:24

well, i guess that’s really list form too 🙂

Sal18:10:03

i think i would have spent hours trying to find the map form. really appreciate the help

joshkh18:10:17

just curious - are you on cloud/ions?

ro621:10:24

Is anyone from Datomic Support around? I'm having trouble deploying to Ions due to the CodeDeploy rolling back. Seems like the same issue as I worked on with @jaret yesterday.

adamfrey21:10:23

I'm following the datomic ions tutorial and I can't pull the datomic ion dependency from s3:

aws s3 cp  .                                                                                                                                                                                                                                                                                              

fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden
My aws cli tool is configured with my work AWS account, is there some permission that is expected that I don't have?

kenny22:10:29

I often receive this error when running an Ion after recently deploying Ions:

java.io.IOException: Connection reset by peer: datomic.ion.lambda.handler.exceptions.Fault
datomic.ion.lambda.handler.exceptions.Fault: java.io.IOException: Connection reset by peer
Is there a way to fix this?