Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CouchDB connection refused #40

Closed
sander opened this issue Apr 9, 2013 · 12 comments
Closed

CouchDB connection refused #40

sander opened this issue Apr 9, 2013 · 12 comments

Comments

@sander
Copy link

sander commented Apr 9, 2013

When starting the hoodie app just created using ‘hoodie new’, all HTTP requests to api.appname.dev return:

An error has occurred: {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"}

After entering an admin password passoword, hoodie crashes because the connection was refused with an invalid JSON response (starting with A).

Below is hoodie’s log.

$ hoodie start

> appname@1.0.0 start /Users/sander/Code/appname
> node node_modules/hoodie-app/lib/hoodie-app.js

Start local couch on port: 6004
CouchDB Started
hoodie server started on port '6003'
[api req] GET /
[api req] GET /
[api req] GET /
Please set an admin password: test[api req] GET /
[api req] GET /

undefined
setup done

open http://appname.dev in your browser

starting: 'worker-users'
initializing appname worker with: 
{ server: 'http://couch.appname.dev:80',
  admin: { user: 'admin', pass: 'test' },
  persistent_since_storage: false,
  name: 'users' }
[users] [Setup] reading global config from modules/module/appconfig …
All workers started.
Your App is ready now.
[static req] GET /
[users] [Setup] reading user config from modules/module/users …

[users] SyntaxError: Unexpected token A 0 [ 'SyntaxError: Unexpected token A',
  '    at Object.parse (native)',
  '    at Request.db_response [as _callback] (/Users/sander/Code/appname/node_modules/hoodie-worker-users/node_modules/hoodie-worker/node_modules/cradle/node_modules/follow/lib/feed.js:121:17)',
  '    at Request.request.self.callback (/Users/sander/Code/appname/node_modules/hoodie-worker-users/node_modules/hoodie-worker/node_modules/cradle/node_modules/follow/node_modules/request/main.js:104:22)',

The couch.stderr file contains a couple of lines like this:
execvp(): No such file or directory

I built CouchDB using homebrew, but installed Node.js using the Mac installer. Could that be the reason it fails (e.g. CouchDB not being able to find node)?

@sander
Copy link
Author

sander commented Apr 9, 2013

After removing the node packaged and installing node using homebrew, I get another error in new hoodie apps:

$ hoodie start

> hoodietest@1.0.0 start /Users/sander/Library/Hoodie/Apps/hoodietest
> node node_modules/hoodie-app/lib/hoodie-app.js

Start local couch on port: 6006
CouchDB Started
hoodie server started on port '6005'
CouchDB stop triggered by exit

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:977:11)
    at Process.ChildProcess._handle.onexit (child_process.js:768:34)

The couch.stderr log contains the same execvp errors.

@janl
Copy link
Member

janl commented Apr 9, 2013

Do you have CouchDB installed? :)

@sander
Copy link
Author

sander commented Apr 10, 2013

Yes, I ran ‘brew install couchdb’, got a couchdb executable in my ~/Code/homebrew/bin folder which is in my PATH, and when I just run ‘couchdb’ without hoodie it shows {"couchdb":"Welcome","version":"1.2.1"} like it should.

@janl
Copy link
Member

janl commented Apr 10, 2013

Excellent, Hoodie currently uses /usr/local/bin hardcoded.

I'll get a fix up asap, in the meantime you could symlink :)

On 10.04.2013, at 06:52, Sander Dijkhuis notifications@github.com wrote:

Yes, I ran ‘brew install couchdb’, got a couchdb executable in my ~/Code/homebrew/bin folder which is in my PATH, and when I just run ‘couchdb’ without hoodie it shows {"couchdb":"Welcome","version":"1.2.1"} like it should.


Reply to this email directly or view it on GitHub.

@sander
Copy link
Author

sander commented Apr 10, 2013

Just symlinking couchdb to /usr/local/bin creates some new errors, probably suggesting that I should symlink more:

heart_beat_kill_pid = 37136
heart_beat_timeout = 11
init terminating heart: Wed Apr 10 23:40:57 2013: inErlang is crashing .. (waiting for crash dump file) d
o_bootshell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
heart_beat_kill_pid = 37149
heart_beat_timeout = 11
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
init terminating in do_boot ()
heart: Wed Apr 10 23:40:58 2013: Erlang is crashing .. (waiting for crash dump file)

@janl
Copy link
Member

janl commented Apr 11, 2013

Sorry for the red herring with the symlink.

I pushed hoodiehq-archive/node-multicouch@5eae3a6 that should™ fix this issue. Can you confirm?

@janl
Copy link
Member

janl commented Apr 11, 2013

To try it out:

$ cd /path/to/yourapp
$ npm install
$ hoodie start

@sander
Copy link
Author

sander commented Apr 11, 2013

Thanks, still no luck though… couch.stderr contains a lot of

heart_beat_kill_pid = 22835
heart_beat_timeout = 11
init terminating in do_boot ()
heart: Thu Apr 11 21:28:53 2013: Erlang is crashing .. (waiting for crash dump file)
/Users/sander/Code/homebrew/Cellar/couchdb/1.2.1/bin/couchdb: line 293: echo: write error: Broken pipe
heart: Thu Apr 11 21:28:54 2013: Executed "/Users/sander/Code/homebrew/Cellar/couchdb/1.2.1/bin/couchdb -k" -> 256. Terminating.

and couch.stdout a lot of

Apache CouchDB crashed, restarting in 5 seconds.
{"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/Users/sander/Code/homebrew/etc/couchdb/default.ini","/Users/sander/Code/homebrew/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{error,enoent}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,56}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,274}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

@janl
Copy link
Member

janl commented Apr 11, 2013

I’m having some trouble reproducing this here, but I’ll keep trying!

@sander
Copy link
Author

sander commented Apr 12, 2013

Some more info: running /Users/sander/Code/homebrew/bin/couchdb directly works. It seems to be 1.2.1 though, and ‘brew upgrade’ doesn’t seem to be so interested in 1.3.0 yet. Does Hoodie maybe expect something from 1.3 during boot already?

@janl
Copy link
Member

janl commented Apr 12, 2013

1.2.1 should work just fine.

@sander
Copy link
Author

sander commented Apr 16, 2013

Just a closing note: so the original issue was solved in node-multicouch, and the new issue seems to be identical to #39.

@sander sander closed this as completed Apr 16, 2013
natevw pushed a commit to natevw/node-multicouch that referenced this issue Dec 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants