Fork me on GitHub
#datomic
<
2018-07-24
>
steveb8n06:07:44

I’m deploying the Specter lib with my Ions. At load time I am seeing a stackoverflow in the logs. I’ll paste it below. This code loads/runs fine on my laptop using the same deps although I do see a deps override warning during push. What is the best way to debug something like this? I’m using Clojure 1.9.0 on my laptop and I presume the same on Ions/Cloud.

stuarthalloway14:07:26

hi @U0510KXTU The Solo template is economized at every level, including having a smaller stack max. I have seen this happen with deep compilation, and (sigh) it can be nondeterministic. AOTing the problem library may help. The problem will definitely go away on Prod.

steveb8n22:07:59

thanks @U072WS7PE that’s good to know. in this case it seems that a classpath issue (still undiscovered) was the real issue, which was then masked by the stackoverflow. maybe there’s greater memory consumption when classpath exceptions occur?

steveb8n22:07:17

either way, some docs on this would be good for others since lots of folks will try ever more libs on Ions/Solo over time. I’m fully sorted now, just got my api working so stoked!

steveb8n06:07:51

{
    "Msg": ":datomic.cluster-node/-main failed: java.lang.StackOverflowError, compiling:(com/rpl/specter/util_macros.clj:61:29)",
    "Ex": {
        "Cause": null,
        "Via": [
            {
                "Type": "clojure.lang.Compiler$CompilerException",
                "Message": "java.lang.StackOverflowError, compiling:(com/rpl/specter/util_macros.clj:61:29)",
                "At": [
                    "clojure.lang.Compiler",
                    "analyzeSeq",
                    "Compiler.java",
                    7010
                ]
            },
            {
                "Type": "java.lang.StackOverflowError",
                "Message": null,
                "At": [
                    "clojure.lang.Util",
                    "equiv",
                    "Util.java",
                    33
                ]
            }
        ],

steveb8n06:07:21

here’s the deps I’m using

org.clojure/clojure        {:mvn/version "1.9.0"}
             com.datomic/client-cloud   {:mvn/version "0.8.56"}
             com.datomic/ion            {:mvn/version "0.9.16"}
             org.clojure/data.json      {:mvn/version "0.2.6"}
             com.rpl/specter            {:mvn/version "1.1.1"}
             com.stuartsierra/component {:mvn/version "0.3.2"}
             com.taoensso/timbre        {:mvn/version "4.10.0"}

steveb8n07:07:46

strange. I just fixed it but not sure how. I changed some of the dependencies from the push warning. I’ll follow up with more info if I can clarify

henrik07:07:33

I’m now rendering a webpage through an Ion, which is awesome. Http-kit works great for developing the page locally. - A couple of questions on top of this: how can I set up API Gateway to allow rendering of /? - What’s the recommended way of serving static content? Should I set a custom domain, create S3 buckets for images, js and css? Or do I serve those directly from the Ion?

henrik09:07:36

I’ve attached a domain to API Gateway. But I’m getting "Missing Authentication Token" for . works fine of course.

henrik09:07:48

Alright, I seem to have figured this one out: create proxy method directly on the root / in API Gateway.

souenzzo10:07:51

Checkout cloudfront. My app has a /html/render/* that generates the index.html Static images and js go to s3 Cloudfront do this redirect / ->> api/html/render, /static ->> s3 You can also do others rules

henrik11:07:02

Oh, right! I just set up a custom domain directly in API Gateway. I’ll dismantle that and figure out Cloudfront instead. Thanks!

henrik15:07:56

@U2J4FRT2T I’m having trouble figuring out how to redirect to API Gateway, while allowing to be redirected to s3. The sources I’m reading are all saying that this only can be done with subdomains. How do you go about routing / and /static respectively?

henrik15:07:19

Those sources were apparently fallacious! I think I got it.

souenzzo15:07:51

Create a distribution (on create, you need to assign it to your loadbalancer/apigateway) in this distribution, create another Origin, assign your S3 bucker. then create some Behaviors to redirect to each origin. be careful with caching. "Cache-Control" "max-age=xxx" is your friend. API call's through cloudfront bay not be a good idea. (Unless you REALLY want the caching thing) You can not do complex regexp on Behaviors.

henrik16:07:15

@U2J4FRT2T Do you have to do anything special with Route 53 when associating the domain name? The domain redirects to the API Gateway <gunk>. rather than hiding it.

souenzzo16:07:31

just alias on r53 it will probably offer you this endpoint as an option for the alias

henrik16:07:12

Right. But it does a redirect, so the raw API Gateway URL ends up exposed to the user.

henrik17:07:08

The path pattern for s3, should it be for example /static/*?

souenzzo18:07:44

Yep. that simple patterns are ok. But at first, i tryied to write "anything that ends with 'dot' + 2 or 3 alphaletters" but that regexp engine dont accept that kind of pattern

henrik06:07:02

I could not for the life of me get Cloudfront to alias instead of redirect, so I ripped it apart and set up S3 to be accessed through the API Gateway.

henrik06:07:43

Then, just for the heck of it, I set up Cloudfront, and for some reason it’s no longer redirecting, but aliasing properly. But now API Gateway is already handling the S3 stuff.

henrik06:07:33

I guess the downside is that I can’t control the caching strategy for the static assets separate to the caching strategy for API Gateway.

stask10:07:21

question about datomic client (not cloud) and peer server. when calling (first (d/tx-range conn {:start 1000 :end 1001})), i’m getting exception like this:

Datomic Client Exception
   {:cognitect.anomalies/category :cognitect.anomalies/fault,
    :datomic.client/http-result {:status nil, :headers nil, :body nil}}
The peer server log has following warning:
2018-07-24 10:32:33.112 WARN  default    datomic.cast2slf4j - {:msg "Could not marshal response", :type :alert, :tid 12, :timestamp 1532428353111, :pid 1560}
java.lang.RuntimeException: java.lang.Exception: Not supported: class clojure.lang.Delay
	at com.cognitect.transit.impl.WriterFactory$2.write(WriterFactory.java:150) ~[transit-java-0.8.311.jar:na]
	at cognitect.transit$write.invokeStatic(transit.clj:149) ~[datomic-transactor-pro-0.9.5661.jar:na]
	at cognitect.transit$write.invoke(transit.clj:146) ~[datomic-transactor-pro-0.9.5661.jar:na]
	at cognitect.nano_impl.marshaling$transit_encode.invokeStatic(marshaling.clj:59) ~[datomic-transactor-pro-0.9.5661.jar:na]
...

stask10:07:51

is tx-range not supported in datomic client with peer server?

rhansen15:07:54

Hmm... What does this error message mean? tempid used only as value in transaction

rhansen15:07:30

Does it mean that I have a tempid somewhere which isn't used in as a value for db/id?

rhansen15:07:22

Also, is it possible to figure out which tempid it is refering to? I have a pretty big transaction 😕

donaldball15:07:27

I believe that means you’ve asserted an entity that has no attributes.

donaldball15:07:22

Probably you could filter the txn for a map that only has a :db/id key.

rhansen20:07:08

The problem was a typo somewhere in my code. 😛

rhansen20:07:00

Would've been much easier to find if the error message included which tempid caused problems though :thinking_face:

✔️ 4