Fork me on GitHub

So… what’s the convention when dealing with keys that have dashes on the name, but working with a db that does not support them (say, Postgres)?


Say, foreign-id. Using foreignid as the column name, or having a mixture of dashes and underscores on the names, seem equally ugly.

Nicolas Boskovic20:03:44

I'm having a db issue with a recent version of Luminus (I think), where trying to operate on a database is giving me this: 'IllegalArgumentException db-spec mount.core.DerefableState@6dc3d84b is missing a required parameter (jdbc.clj:292)'

Nicolas Boskovic20:03:18

I'm afraid the REPL connection didn't do it

Nicolas Boskovic20:03:22

And it doesn't seem to be an issue with the syntax for calling up the query or the query itself


Probably a question best answered by @yogthos . I've seen a few folks run into this with luminus & mount, but I'm not sure all of the steps for troubleshooting.


@nnbosko: you have to make sure that the database component is started


if you do lein run then start-app function gets called and starts up all the components


if you’re starting the repl then you probably want to either run that or run (start) in the user namespace, the repl should default to it


my recommended approach is to use lein run to start the app, and then connect to the nrepl that it starts on port 7000

Nicolas Boskovic20:03:14

Yes, it's what I just tried


another question is whether the database namespace is referenced anywhere


if it’s not then mount won’t start it automatically


something like (mount/start #’app.db.core/db)

Nicolas Boskovic20:03:46

It's required by an auth service, I'm on its namespace calling up a db query through it


that should cause it to start

Nicolas Boskovic20:03:08

Basically I'm going through the gallery tutorial on the Web dev book


do you see anything to that effect in the console log?

Nicolas Boskovic20:03:32

[2016-03-11 17:21:16,140][INFO][com.zaxxer.hikari.HikariDataSource] HikariPool-0 - is starting.

Nicolas Boskovic20:03:40

[2016-03-11 17:21:16,563][INFO][wstore.core] #'wstore.db.core/db started


ok so it should be running then


and your db.core namespace looks something like this at the top?


so that all looks right


at what point do you get the error?

Nicolas Boskovic20:03:25

It happens when I'm calling up the register! function


and are you calling it from the repl?


or from the route by the client?

Nicolas Boskovic20:03:19

Yes, which is connected to the app's nREPL server

Nicolas Boskovic20:03:34

Calling it from the client raises the same error


hmm everything seems like it should be in order

Nicolas Boskovic20:03:06

Yeah, I haven't really deviated from the tutorial either


can you try running (require '[ :as graph]) (graph/states-with-deps)


to see what mount thinks is started

Nicolas Boskovic20:03:37

Here's the full trace


right postgres likes to wrap its exceptions


so looks like the state is started fine


I guess another thing to look at is your connection string


the profiles.clj file in the project folder should have a :database-url in it


that should be a url that will connect to your local postgres

Nicolas Boskovic20:03:32

Yes, the URL is correct

Nicolas Boskovic20:03:14

I'm going to check a previous project I had to see if I can hook up to the db from there


yeah I’m a bit stumped on this one

Nicolas Boskovic20:03:29

Ran a clean and rebuilt just in case, still nothing


hmm could you put it up on github maybe?

Nicolas Boskovic20:03:57

Do you have a gitlab account?


I could make one simple_smile


and yeah I’m not seeing this with a fresh app locally either


for example I got [2016-03-11 15:37:05,596][DEBUG][org.jboss.logging] Logging Provider: org.jboss.logging.Log4jLoggerProvider [2016-03-11 15:37:07,244][INFO][luminus.http-server] starting HTTP server on port 3000 [2016-03-11 15:37:07,308][INFO][org.xnio] XNIO version 3.4.0.Beta1 [2016-03-11 15:37:07,425][INFO][org.xnio.nio] XNIO NIO Implementation Version 3.4.0.Beta1 [2016-03-11 15:37:07,529][INFO][org.projectodd.wunderboss.web.Web] Registered web context / [2016-03-11 15:37:07,532][INFO][luminus.repl-server] starting nREPL server on port 7000 [2016-03-11 15:37:07,567][INFO][myapp.core] #'myapp.config/env started [2016-03-11 15:37:07,567][INFO][myapp.core] #'myapp.core/http-server started [2016-03-11 15:37:07,567][INFO][myapp.core] #'myapp.core/repl-server started [2016-03-11 15:37:07,568][INFO][myapp.env] -=[myapp started successfully using the development profile]=-


lein repl :connect 7000 Connecting to nREPL at REPL-y 0.3.7, nREPL 0.2.12 Clojure 1.8.0 Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14 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=> (use 'myapp.db.core) nil user=> (get-user {:id ""}) nil


so it’s definitely something funky in that specific project


Does your postgresql log file provide any clues?

Nicolas Boskovic21:03:47

I missed a column name by one letter, it was in the psql logs, thanks @curtis.summers

Nicolas Boskovic21:03:52

And thank you for your time, @yogthos


ah it’s always something silly simple_smile

Nicolas Boskovic21:03:36

Yes, the stack traces could be a little better for jdbc


they are terrible


it’s sad that it goes to the postgres log, but not back to the client


simple_smile I usually tail -f my postgresql log in a terminal when I'm writing a bunch of queries because of past experiences hunting for this kind of error. Glad you figured it out.

Nicolas Boskovic21:03:24

Thanks to you guys. Better keep going with this then simple_smile


@curtis.summers: and good call on checking the postgres log simple_smile


I always forget it has more info than what you get back in the errors on the client