Skip to content

Known hosts error #107

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

Closed
lifwanian opened this issue Jul 19, 2016 · 10 comments
Closed

Known hosts error #107

lifwanian opened this issue Jul 19, 2016 · 10 comments

Comments

@lifwanian
Copy link

I keep getting a knownHosts error on boot. Is this just a warning that the directory doesnt exists and that its being created? Is this a folder we can create ourselves? Or am I missing something?

Driver:

var neo4j = require('neo4j-driver').v1;
var driver = neo4j.driver(_URI_, neo4j.auth.basic(_USER_, _PASS_), {
    trust: 'TRUST_ON_FIRST_USE',
    encrypted: true
});
var session = driver.session();

Error:

[Error: ENOENT: no such file or directory, open '/app/.neo4j/known_hosts']
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/app/.neo4j/known_hosts'

Running:

node: 4.4.5
npm: 2.15.5
neo4j: 3.0.2
neo4j-driver: 1.0.2
@bkapicka
Copy link

I can't comment on what introduced the error or if we are expected to create the folder/file by design, but I found that creating a blank known_hosts at the path in the error ('/app/.neo4j/known_hosts' in your case) resolved the error.

A similar issue was outlined here: http://www.markhneedham.com/blog/2016/07/11/neo4j-3-0-drivers-failed-to-save-the-server-id-and-the-certificate-received-from-the-server/

@lifwanian
Copy link
Author

Hmm, interesting... Just tried it and everything seemed to be fine for a few calls, then all of a sudden things started blowing up. Tried both root folder and /.neo4j like in example:

/app/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:214
      for (var i = 0; i < pending.length; i++) {
                                 ^

TypeError: Cannot read property 'length' of null
    at /app/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:214:34
    at /app/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:141:11
    at Interface.<anonymous> (/app/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:76:7)
    at emitOne (events.js:77:13)
    at Interface.emit (events.js:169:7)
    at Interface._onLine (readline.js:211:10)
    at Interface.<anonymous> (readline.js:341:12)
    at Array.forEach (native)
    at Interface._normalWrite (readline.js:340:11)
    at ReadStream.ondata (readline.js:87:10)
    at emitOne (events.js:77:13)
    at ReadStream.emit (events.js:169:7)
    at readableAddChunk (_stream_readable.js:153:18)
    at ReadStream.Readable.push (_stream_readable.js:111:10)
    at onread (fs.js:1739:12)
    at FSReqWrap.wrapper [as oncomplete] (fs.js:576:17)

@jgkim
Copy link

jgkim commented Jul 21, 2016

I have the same issue with @lifwanian. Any workaround?

@legraphista
Copy link
Contributor

Same issue here.

I solved it by creating the folder {...}/.neo4j/ and letting the driver create it's own known_hosts file instead of me creating a blank file.

Hope it helps.

@jgkim
Copy link

jgkim commented Jul 21, 2016

@legraphista, does making the driver known_hosts instead of me creating a blank file make a difference?

@legraphista
Copy link
Contributor

legraphista commented Jul 21, 2016

@jgkim if you create a blank file, the driver will try to parse it, then something bad happens and it will error out.
If the driver doesn't see the file, it will create a new one and not do the parsing. You just have to make sure the known_hosts can be created and the folder is there.

@jgkim
Copy link

jgkim commented Jul 21, 2016

@legraphista Thank you for the info! 👍

@legraphista
Copy link
Contributor

I'm glad to be of help

@oskarhane
Copy link
Member

This should now be fixed with this commit c09ab5b

@dan-kez
Copy link

dan-kez commented Nov 18, 2016

I've recently started receiving this error again when using my app within a docker container. I've put my docker-compose.yaml file below.

I was able to fix this temporarily by running the following. It looks like the docker user can't create this directory and that's the issue.

 docker exec -it testapi_app_1 mkdir /root/.neo4j
version: '2'

services:
  neo4j:
    image: neo4j/neo4j-experimental:3.1.0-M13-beta3
    environment:
      NEO4J_AUTH: none
    ports:
      - "17474:7473"
    volumes:
      - ./db/plugins:/plugins
      # If you want data to persist between sessions uncomment the following line
#      - ./db/data:/data

  app:
    image: node:6.9
    volumes:          ## adds app folder to the container
     - .:/app
    links:            ## connects neo4j to app container
     - neo4j
    ports:            ## publish ports
     - "3000:3000"
    working_dir: /app         ## uses work dir /app
    entrypoint: npm run dev  ## starts application

EDIT: Specific Error Text:

app_1    | { Error: ENOENT: no such file or directory, open '/root/.neo4j/known_hosts'
app_1    |     at Error (native)
app_1    |   errno: -2,
app_1    |   code: 'ENOENT',
app_1    |   syscall: 'open',
app_1    |   path: '/root/.neo4j/known_hosts' }

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

6 participants