Fork me on GitHub
#portkey
<
2017-10-20
>
qqq16:10:12

I just installed a portkey function via (pk/mount): I get error:

{"errorMessage":"Error loading class portkey.LambdaStub: clojure/lang/IFn","errorType":"java.lang.NoClassDefFoundError"}
my code is:
(defn flatter []
  (str "hello world"))

(pk/mount! flatter "/hello")


Is there a wa I can manually inspect the zip/jar that was uploaded ?

baptiste-from-paris16:10:34

You can download it on the aws interface

baptiste-from-paris16:10:50

But you won’t learn anything as it’s bytecode

qqq16:10:07

Weird, on the AWs interface, I see a "clj-hello" (which is some other functikn I manually uploaded), but I don' see the "flatter / hello" function.

qqq16:10:25

I want to open up the jar/zind see if Clojure/IFN .class is somewhere there.

baptiste-from-paris16:10:30

You sure you are in the right region ?

qqq16:10:06

I'm an idiot.

qqq16:10:10

Was in wrong region.

baptiste-from-paris16:10:28

Not an idiot, this happen ;-)

baptiste-from-paris17:10:00

Do you still mount it from boot ?

qqq17:10:20

Yeah, I have never tried mounting from lein.

qqq17:10:32

cgrand sent in a patch, so I assumed mounting from boot works ....

baptiste-from-paris17:10:39

Because lambdastub call the handler that aws is waiting for, it should be present

baptiste-from-paris17:10:48

I had some personnal stuff last week so I won’t be able to work on portkey for an other week but even if there are still bugs, your function is working for me

qqq17:10:23

Awesome, thanks!

qqq17:10:03

I will take this opportunity to to build a Cryptic-AWS-Error-Msg -> how-to-fix-it map 🙂

cgrand17:10:09

I will be back on business on Tuesday

baptiste-from-paris17:10:39

@qqq that’s something that can be upgrade, how to shorten the error-message feedback loop

qqq17:10:27

I downloaded my package (took a while to figure out the GUI). I run:

find . | grep Lambda
./com/amazonaws/services/lambda/runtime/LambdaLogger.class
./portkey/LambdaStub.class
so it appears that portkey/LambdaStub.class indeed is there.

qqq17:10:11

find clojure
clojure
clojure/java
clojure/java/api
clojure/java/api/Clojure.class
Hmm, is that supposed to happen ?

qqq17:10:21

I'm expecting to see clojure/foobar/IFn.class

baptiste-from-paris17:10:49

Have you try to reboot your repl and re-mount it ?

qqq17:10:08

I will try that right now.

cgrand17:10:40

Almost home. Enjoying traffic jams due to the start of fall holidays.

qqq17:10:10

@baptiste-from-paris: same issue; will now see if I can get mount to work via a lein repl

baptiste-from-paris17:10:51

Ok, if it doesn’t pastebin your code and I’ll try

qqq17:10:56

lein repl
nREPL server started on port 40198 on host 127.0.0.1 - 
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.9.0-beta2
OpenJDK 64-Bit Server VM 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (require '[portkey.core :as pk])
WARNING: get-method already refers to: #'clojure.core/get-method in namespace: portkey.aws.apigateway, being replaced by: #'portkey.aws.apigateway/get-method
nil
user=> (defn ltalk [] (str "hello world"))
#'user/ltalk
user=> (pk/mount! ltalk "/hi")

NullPointerException   portkey.ouroboros/bytecode (ouroboros.clj:227)
user=> (ltalk)
"hello world"
user=> (pk/mount! ltalk "/")

NullPointerException   portkey.ouroboros/bytecode (ouroboros.clj:227)

qqq17:10:10

weirdness; Lein gets an ouroboros NullPointerException ?

qqq17:10:50

here is my project.clj:

cat project.clj 
(defproject foobar "0.1.0-SNAPSHOT"
 :description "FIXME: write description"
 :url ""
 :license {:name "Eclipse Public License"
 :url ""}
 :dependencies [[org.clojure/clojure "1.9.0-beta2"]
 [portkey "0.1.0-SNAPSHOT"] ])

qqq17:10:58

I'm going to go nuke ~/.m2 and retry all this.

baptiste-from-paris17:10:06

Ok, let me try (and take a break from my bordeaux wine)

qqq17:10:56

hmm, I just did a git pull, ouroboros was updated, perhaps I am facing an older bug

qqq17:10:24

success: from lein repl, I got a clj function to mount 🙂

qqq17:10:46

I don't knowif this issue is boot vs lein or "old code vs doing a git pull"

qqq17:10:54

but once ~/.m2 is repopulated, I will test in boot repl

qqq17:10:47

I think the boot repl is tree shaking too much.

qqq17:10:56

lein repl -- uploaded a 4.5 MB zip

qqq17:10:06

boot repl -- uploladed a 1.5MB zip (earlier) and a 300k zip (now)

baptiste-from-paris17:10:20

personnaly I rarely have mounting problem, it’s more error once mounted

qqq17:10:31

so it's apparently shaking the tree soo hard clojure function classes are being shaken off

baptiste-from-paris17:10:15

@qqq does not sound satisfying, I think Clojure itself is around 3MB

qqq17:10:48

find lein | grep -i clojure ; echo "==" ; find boot | grep -i clojure
lein/clojure
lein/clojure/java
lein/clojure/java/api
lein/clojure/java/api/Clojure.class
lein/lib/clojure-1.9.0-beta2.jar
==
boot/clojure
boot/clojure/java
boot/clojure/java/api
boot/clojure/java/api/Clojure.class
I downloaded the lein / boot versions.

qqq17:10:02

The lein version includes clojure-...-.jar ; the boot version somehow does not.

qqq17:10:18

I'm half tempted now to add the jar file into the boot version, and manually upload it 🙂

qqq17:10:15

okay, I got the boot version to work

qqq17:10:31

by copying over /lein-version/lib to /boot-version/lib , recreating the zip, and uploading it

qqq17:10:38

I'm filing an issue on github.

qqq17:10:28

@cgrand: ^-- welcome home gift for you 🙂

qqq17:10:01

@baptiste-from-paris: thanks for the tip on downloading from aws // could not have debugged this without that

baptiste-from-paris20:10:22

By the way, I can’t verify right now but I am pretty sure that you can download it with the api

qqq23:10:32

@cgrand @baptiste-from-paris: i realize portkey is open source software with no SLA and the volunterr devs have lives of their own -- is there some hack I can use to get around this in boot? This is on the critical path of my work.

qqq23:10:59

I just switched from boot to lein; this is no longer blocking me. 🙂