0

I am learning to use neo4j with rails using the neo4jrb project: https://github.com/neo4jrb/neo4j/wiki/Neo4j-v3-Setup#usage-from-rails

As given in instructions i did

rails new testdb_app -m http://neo4jrb.io/neo4j/neo4j.rb -O

Since i already have my neo4j server installed in my ubuntu machine i did not use the rake tasks to start the server.

I set the correct username and password in application.rb like this

config.neo4j.session_options = { basic_auth: { username: 'neo4j', password: '******'} } 
config.neo4j.session_type = :server_db 
config.neo4j.session_path = 'http://localhost:7474'

But when i do :

rails generate scaffold User name:string email:string

It throws an error in: neo4j-core-5.1.6/lib/neo4j-server/cypher_session.rb:51:in `open': Server not available on http://localhost:7474 (response code 403) (RuntimeError)

But I checked that server is running by visting the url: http://localhost:7474 and i am able to login with the username and password.

What am i doing wrong, is there an issue because i am behind a proxy server (I do have my bash proxy environment variables set).

Christophe Willemsen
  • 19,399
  • 2
  • 29
  • 36
Vikash Balasubramanian
  • 2,921
  • 3
  • 33
  • 74
  • Didn't notice that status code before! A 403 suggests your auth credentials are wrong. Double check them. You might also want to disable auth for dev purposes or at least to verify that the rest of your connection settings are accurate. – subvertallchris Oct 04 '15 at 01:19
  • @subvertallchris It works when i host on other remote host but fails on localhost – Vikash Balasubramanian Oct 04 '15 at 07:56
  • When you connect to the remote, do you have to add any proxy configuration settings to your app? – subvertallchris Oct 04 '15 at 14:56
  • @subvertallchris no when i connect to remote i don't add any proxy configuration to my app but still it works (as long as i disable password, if password auth is enabled it gets stuck). – Vikash Balasubramanian Oct 04 '15 at 16:32
  • If the remote machine is after the proxy and you are able to connect to it without adding any extra configuration, it means Ruby (`Net::Http::Persistent` in our case, used by Faraday to connect) is detecting some system config and using the proxy for you. I don't know if that's possible but if that is true, it may be trying to use the proxy for a local connection, which you probably don't want. – subvertallchris Oct 04 '15 at 18:21
  • You might want to increase Neo4j's logging settings to record all HTTP traffic. You should try to determine the source of the 403. I'm traveling and unfortunately don't have access to the steps to do that but you can find it through Neo4j's documentation. Make sure to restart your server after making the change. – subvertallchris Oct 04 '15 at 18:23
  • Take a look at the accepted answer at http://stackoverflow.com/questions/32922891/server-not-available-on-localhost-with-response-code-403-runtimeerror-in-ruby/32929077. It has some troubleshooting suggestions. – subvertallchris Oct 06 '15 at 12:15

0 Answers0