Neo4j Javascript驱动程序服务器保持到期会话

时间:2017-01-06 05:36:12

标签: javascript node.js neo4j websocket

我在节点7.3.0,7.3.1和8.0.1中尝试了以下内容:

import * as v1 from 'neo4j-driver';

const neo4j = v1.v1;
const auth = neo4j.auth.basic( 'neo4j', 'password' );
console.log( 'auth.basic returned: ' + JSON.stringify( auth ));
const driver = neo4j.driver( 'bolt://localhost', auth );
const session = driver.session();

const query = `
    CREATE (string:TEST:Type {name: 'String'})
    CREATE (int:TEST:Type {name: 'Int'})
    CREATE (id:TEST:Type {name: 'ID'})
    CREATE (query:TEST:Type {name: 'Query'})
    CREATE (mutation:TEST:Type {name: 'Mutation'})
    CREATE (subscription:TEST:Type {name: 'Subscription'})
    CREATE (author:TEST:Type {name: 'Author'})
    CREATE (post:TEST:Type {name: 'Post'})
    CREATE (comment:TEST:Type {name: 'Comment'})
`

session.run( { statements: query } )
    .then( ( result ) => {
        console.log( result );
    } )
    .catch( ( err ) => { console.log( err ); } );

这给了我(启用调试):

auth.basic returned: {"scheme":"basic","principal":"neo4j","credentials":"password"}
C:INIT "neo4j-javascript/0.0.0-dev" {"scheme":"basic","principal":"neo4j","credentials":"password"}
S:SUCCESS {"server":"Neo4j/3.1.0"}
C:RUN {"statements":"\n\tCREATE (string:TEST:Type {name: 'String'})\n\tCREATE (int:TEST:Type {name: 'Int'})\n\tCREATE (id:TEST:Type {name: 'ID'})\n\t
CREATE (query:TEST:Type {name: 'Query'})\n\tCREATE (mutation:TEST:Type {name: 'Mutation'})\n\tCREATE (subscription:TEST:Type {name: 'Subscription'})\
n\tCREATE (author:TEST:Type {name: 'Author'})"} {}
C:PULL_ALL
{ Error: Connection was closed by server
    at new Neo4jError (/Users/timhope/Dev/ts-koapollo/node_modules/neo4j-driver/lib/v1/error.js:65:132)
    at newError (/Users/timhope/Dev/ts-koapollo/node_modules/neo4j-driver/lib/v1/error.js:55:10)
    at NodeChannel._handleConnectionTerminated (/Users/timhope/Dev/ts-koapollo/node_modules/neo4j-driver/lib/v1/internal/ch-node.js:330:41)
    at emitNone (events.js:91:20)
    at TLSSocket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9) code: 'SessionExpired' }

我想也许这是一个螺栓或服务器端问题,所以我尝试了cypher-shell。

通过cypher-shell进行相同的查询:

bash-3.2$ ./neo4j-community-3.1.0/bin/cypher-shell
username: neo4j
password: ********
Connected to Neo4j 3.1.0 at bolt://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j> :help

Available commands:
  :begin    Open a transaction
  :commit   Commit the currently open transaction
  :exit     Exit the logger
  :help     Show this help message
  :history  Print a list of the last commands executed
  :param    Set the value of a query parameter
  :params   Prints all currently set query parameters and their values
  :rollback Rollback the currently open transaction

For help on a specific command type:
    :help command


For help on cypher please visit:
    https://neo4j.com/docs/developer-manual/3.1-beta/cypher/

neo4j> CREATE (string:TEST:Type {name: 'String'})
       CREATE (int:TEST:Type {name: 'Int'})
       CREATE (id:TEST:Type {name: 'ID'})
       CREATE (query:TEST:Type {name: 'Query'})
       CREATE (mutation:TEST:Type {name: 'Mutation'})
       CREATE (subscription:TEST:Type {name: 'Subscription'});
Added 9 nodes

我绝对难过,非常感谢任何帮助。我疯了。我已经尝试了数百万种开始和结束会话和驱动程序无济于事。

0 个答案:

没有答案