Fork me on GitHub
#portkey
<
2017-10-02
>
baptiste-from-paris08:10:12

for information, I have this error when trying a simple get call

baptiste-from-paris08:10:31

Attempting to call unbound fn: #'clj-http.core/request: java.lang.IllegalStateException
java.lang.IllegalStateException: Attempting to call unbound fn: #'clj-http.core/request
at clojure.lang.Var$Unbound.throwArity(Var.java:45)
at clojure.lang.AFn.invoke(AFn.java:32)
at clojure.lang.Var.invoke(Var.java:381)
at clj_http.client$wrap_request_timing$fn__4812.invoke(client.clj:1046)
at clj_http.client$wrap_async_pooling$fn__4820.invoke(client.clj:1079)
at clj_http.headers$wrap_header_map$fn__2936.invoke(headers.clj:147)
at clj_http.client$wrap_query_params$fn__4700.invoke(client.clj:806)
at clj_http.client$wrap_basic_auth$fn__4706.invoke(client.clj:829)
at clj_http.client$wrap_oauth$fn__4711.invoke(client.clj:846)
at clj_http.client$wrap_user_info$fn__4720.invoke(client.clj:866)
at clj_http.client$wrap_url$fn__4794.invoke(client.clj:998)
at clj_http.client$wrap_decompression$fn__4471.invoke(client.clj:414)
at clj_http.client$wrap_input_coercion$fn__4624.invoke(client.clj:626)
at clj_http.client$wrap_additional_header_parsing$fn__4649.invoke(client.clj:681)
at clj_http.client$wrap_output_coercion$fn__4611.invoke(client.clj:570)
at clj_http.client$wrap_exceptions$fn__4418.invoke(client.clj:248)
at clj_http.client$wrap_accept$fn__4664.invoke(client.clj:724)
at clj_http.client$wrap_accept_encoding$fn__4671.invoke(client.clj:746)
at clj_http.client$wrap_content_type$fn__4658.invoke(client.clj:707)
at clj_http.client$wrap_form_params$fn__4767.invoke(client.clj:948)
at clj_http.client$wrap_nested_params$fn__4789.invoke(client.clj:983)
at clj_http.client$wrap_method$fn__4725.invoke(client.clj:882)
at clj_http.cookies$wrap_cookies$fn__1825.invoke(cookies.clj:131)
at clj_http.links$wrap_links$fn__3248.invoke(links.clj:63)
at clj_http.client$wrap_unknown_host$fn__4797.invoke(client.clj:1009)
at clj_http.client$request_STAR_.invokeStatic(client.clj:1181)
at clj_http.client$request_STAR_.invoke(client.clj:1174)
at clj_http.client$get.invokeStatic(client.clj:1187)
at clj_http.client$get.doInvoke(client.clj:1183)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at port.core$handler.invokeStatic(core.clj:61)
at port.core$handler.invoke(core.clj:56)
at portkey.core$mount_ring_BANG_$wrap__17167.invoke(core.clj:705)
at portkey.LambdaStub.handleRequest(LambdaStub.java:33

baptiste-from-paris08:10:01

with this code

(defn handler
  [request]
  (response/response (client/get "")))

viesti15:10:18

hum, does it work with with older clojure, say 1.9.0-alpha19?

cgrand15:10:10

I don’t know but I just reproduced @baptiste-from-paris error

cgrand15:10:37

and I checked clojure, no change around require handling

viesti15:10:18

reproducible errors are warm and fuzzy

baptiste-from-paris15:10:21

just to be sure, portkey only loads java class right ? For example, if you take the google-api-client, you have the key store which is store in a jks file and called like this =>

public static synchronized KeyStore getCertificateTrustStore()
      throws IOException, GeneralSecurityException {
    if (certTrustStore == null) {
      certTrustStore = SecurityUtils.getJavaKeyStore();
      InputStream keyStoreStream = GoogleUtils.class.getResourceAsStream("google.jks");
      SecurityUtils.loadKeyStore(certTrustStore, keyStoreStream, "notasecret");
    }
    return certTrustStore;
  }

baptiste-from-paris15:10:52

it’s not found offcourse ^^, right ?

cgrand15:10:20

It should be found

cgrand15:10:42

We really need a verbose mode for packaging

baptiste-from-paris15:10:06

ok, it’s not, at least keyStore is empty in lambda, working locally

baptiste-from-paris15:10:52

by the way, you call keeps like that right ? => (pk/mount-ring! #'handler :keeps ["file1" "file2"])

viesti15:10:25

yes, a set may be more descriptive, so #{"path/to/resource-on-classpath"}

viesti15:10:38

for now, you can download the lambda zip to check that resource is there

cgrand16:10:39

You want us to step outside of the comfort or our repl? Never!

viesti07:10:26

no, being lazy 🙂 Maybe option for keeping the zip locally?

baptiste-from-paris15:10:55

done that and it was not working

baptiste-from-paris15:10:05

done some modifications

baptiste-from-paris15:10:19

cause it seq’ like this (#{“path”}) so the (into {} (comp fn*) returns nil

baptiste-from-paris15:10:22

I am not sure if I am right

baptiste-from-paris15:10:41

but it’s working for me

cgrand16:10:49

(wrap-request #'core/request) a new trick to teach to the abstract interpreter

viesti17:10:27

maybe this could even be behind a dynamic var, to look for new analysis at the repl: https://github.com/portkey-cloud/portkey/blob/master/src/main/clojure/portkey/analysis.clj#L112

baptiste-from-paris17:10:54

analysis.clj is used for what ?

baptiste-from-paris17:10:24

sorry again, but I got this new error that I never saw

Error loading class portkey.LambdaStub: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
Caused by: com.esotericsoftware.kryo.KryoException: java.lang.IllegalStateException
Serialization trace:
provider (java.security.SecureRandom)
secureRandom (sun.security.ssl.SSLContextImpl$TLSContext)
contextSpi (javax.net.ssl.SSLContext)
sslContext (org.apache.http.nio.conn.ssl.SSLIOSessionStrategy)
map (org.apache.http.config.Registry)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:144)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:540)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:540)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:540)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:540)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:161)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:39)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:540)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813)
at carbonite.serializer$mk_collection_reader$fn__190.invoke(serializer.clj:57)
at clojure.lang.Var.invoke(Var.java:385)
at carbonite.ClojureVecSerializer.read(ClojureVecSerializer.java:17)
at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:813)
at portkey.kryo$unfreeze.invokeStatic(kryo.clj:91)
at portkey.kryo$unfreeze.invoke(kryo.clj:87)
at portkey.core$bootstrap$fn__16755.invoke(core.clj:189)
at portkey.LambdaStub.<clinit>(LambdaStub.java:23)
... 2 more
Caused by: java.lang.IllegalStateException
at java.security.Provider.checkInitialized(Provider.java:650)
at java.security.Provider.check(Provider.java:655)
at java.security.Provider.put(Provider.java:317)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:162)
at com.esotericsoftware.kryo.serializers.MapSerializer.read(MapSerializer.java:39)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:731)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:125)

baptiste-from-paris17:10:50

I am pretty sure it’s generated by this line => (ring.util.codec/form-decode body)

baptiste-from-paris17:10:42

because it happened just after I added it

cgrand18:10:38

@baptiste-from-paris thanks for trying it’s really really useful

cgrand18:10:09

Analysis is about interpreting dynamic patterns used with mostly static arguments to get information on classes or Vars they may require

baptiste-from-paris18:10:04

I think I can become addict to port key 😂! Would be awesome to connect a repl somehow

cgrand20:10:38

My guess was wrong: our Kryo var serializer doesn’t kick in.