ad-hoc-views fails w/ cljs views #4

sritchie opened this Issue Mar 20, 2012 · 4 comments


None yet

2 participants


Here's my function:

(c/with-db local-db
   (c/view-server-fns :cljs
                      {:cake {:map (fn [doc]
                                     (js/emit (aget doc "_id") nil))}})))

And here's the error I get from CouchDB:

=ERROR REPORT==== 20-Mar-2012::07:30:58 ===
** Generic server <0.10146.0> terminating 
** Last message in was {'EXIT',<0.10145.0>,
                                <<"Expression does not eval to a function. ((new String(\"undefined\")))">>}}
** When Server state == {file,{file_descriptor,prim_file,{#Port<0.2401>,18}},
** Reason for termination == 
** {<<"compilation_error">>,
    <<"Expression does not eval to a function. ((new String(\"undefined\")))">>}
[error] [<0.10146.0>] {error_report,<0.30.0>,
                             <<"Expression does not eval to a function. ((new String(\"undefined\")))">>},

=CRASH REPORT==== 20-Mar-2012::07:30:58 ===
    initial call: couch_file:init/1
    pid: <0.10146.0>
    registered_name: []
    exception exit: {<<"compilation_error">>,
                     <<"Expression does not eval to a function. ((new String(\"undefined\")))">>}
      in function  gen_server:terminate/6 (gen_server.erl, line 737)
    ancestors: [<0.10145.0>,<0.10144.0>]
    messages: [{'EXIT',<0.10148.0>,shutdown}]
    links: []
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 377
    stack_size: 24
    reductions: 1321
[info] [<0.10125.0>] - - 'POST' /paddleguru/_temp_view 500

Confirmed. Decidedly different than the other issue from irc (which I haven't been able to verify, BTW): the "undefined" bit is obviously wrong.

I'll see what I can find; FWIW, ad-hoc views are (AFAIK) on the chopping block for some future rev of couchdb (they aren't practical in Cloudant/bigcouch-style clustered environments).


I verified the issue on IRC! It has to do with AOT. I'm AOT compiling my main namespace, which transitively AOT compiles the cljs compiler (after a couple of hops). That breaks because of this bug:

The solution for now is to rm -rf classes/cljs after the AOT compilation takes place. Pretty janky, but at least it gets the job done.


Fixing AOT default transitivity is probably an easier / more likely fix, though that's long-standing too:

Thanks for chasing that down.

cemerick commented May 7, 2012

Closing this now; note that ClojureScript view functionality has been rolled into Clutch proper.

@cemerick cemerick closed this May 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment