Fork me on GitHub
#pedestal
<
2016-11-21
>
mrcnc21:11:53

i’m getting this error when trying to build an uberjar Caused by: java.lang.IllegalArgumentException: No matching ctor found for class io.pedestal.interceptor.helpers$before$fn__1340

mrcnc21:11:11

the thing that’s confusing me is that i’m not even using the before helper

mtnygard21:11:04

@mrcnc I can help, but will need to look at some code with you. Can you share it here or would you prefer to go to a private chat?

mrcnc21:11:28

i can share here…what do you need?

mtnygard21:11:58

How many namespaces do you have in the uberjar?

mrcnc21:11:44

looks like 30

mtnygard21:11:59

Hmm. Too many to go through right here.

mrcnc21:11:43

what namespaces are you talking about? pedestal namespaces or for my app?

mtnygard21:11:29

Something in one of them is expanding out to a before or defbefore call at compilation time.

mtnygard21:11:07

That "no matching ctor" message is what happens when there's a function value emitted as code from a macro. Often due to misplaced quoting.

mtnygard21:11:16

Let's take a look at the namespace with your routes first.

mrcnc21:11:49

my routes are spread over a few namespaces

mtnygard22:11:26

Would you try something for me? Convert the defhandler into just defn on authenticate-user and authorize-user.

ddeaguiar22:11:35

Piggybacking on @mtnygard's suggestion, I'll add that you should avoid using helpers like defhandler because they can lead to weird compilation issues.

ddeaguiar22:11:56

They're still around for backwards compatibility

ddeaguiar22:11:51

fns can be used as handlers because they extent the IntoInterceptor protocol (https://github.com/pedestal/pedestal/blob/master/interceptor/src/io/pedestal/interceptor.clj#L33). This means that your usage of defhandler isn't buying you anything over defn.

mrcnc22:11:07

so mtnygard that worked! and thx for the tip @ddeaguiar

ddeaguiar22:11:17

Unfortunately I don't think the docs are very clear about staying away from some of the helpers.

mrcnc22:11:27

i think i’ll go refactor all of my usages of defhandler now

mtnygard22:11:36

Cool. I've run into trouble with macros and AOT many times before. Uberjar often hits AOT so I had a hunch.

mtnygard22:11:52

@ddeaguiar Would you be willing to file an issue on that?

ddeaguiar22:11:59

Stay away from any helpers built using defsimpleinterceptordef.

donaldball22:11:04

I build all my routes and interceptors at system start time, not at compile time. I don’t know if that’s pedestal’s recommended approach, but I find it much easier to reason about.