neo4j / neo4j-javascript-driver

Neo4j Bolt driver for JavaScript
https://neo4j.com/docs/javascript-manual/current/
Apache License 2.0
853 stars 148 forks source link

Neo4jError: The client is unauthorized due to authentication failure #1217

Open studentemmyeze opened 1 month ago

studentemmyeze commented 1 month ago

Bug Report

I try to run this simple connection to neo4j test function it works for this setting- Neo4j version: 4.2.1 (enterprise), Node version: v16.20.2 OS: Mac and Windows 11 but not this setting Neo4j version: 4.2.19 (community), Node version: v16.17.0 OS: Windows 11

//app.js const db = require('./db'), async function DBLogin() { const session = db.driver.session({ database: 'neo4j' }); // console.log({session}) try { const serverInfo = await db.driver.getServerInfo() console.log("Connection to DB made successfully") app.listen(3000,() => console.log(korote-backend server started at 3000!)) } catch (error) { console.error(Something went wrong: ${error}); } finally { await session.close(); console.log('done') } }

//db.js const username = process.env.USERNAME const password = process.env.PASSWORD

module.exports.driver = neo4j.driver( 'bolt://localhost:7687', neo4j.auth.basic(username, password), {

            disableLosslessIntegers: true} 

);

//debug.log 2024-09-04 08:41:38.371+0000 INFO [o.n.k.a.DatabaseAvailabilityGuard] [neo4j/67cc2d94] DatabaseId{67cc2d94[neo4j]} is ready. 2024-09-04 08:41:38.371+0000 INFO [o.n.m.DatabaseHealth] [neo4j/67cc2d94] Database health set to OK 2024-09-04 08:41:39.012+0000 INFO [o.n.b.BoltServer] Bolt enabled on 0.0.0.0:7687. 2024-09-04 08:41:39.012+0000 INFO [o.n.s.AbstractNeoWebServer$ServerComponentsLifecycleAdapter] Starting web server 2024-09-04 08:41:40.810+0000 INFO [o.n.s.CommunityNeoWebServer] Remote interface available at http://localhost:7474/ 2024-09-04 08:41:40.810+0000 INFO [o.n.s.AbstractNeoWebServer$ServerComponentsLifecycleAdapter] Web server started. 2024-09-04 08:42:03.520+0000 WARN [o.n.b.r.DefaultBoltConnection] The client is unauthorized due to authentication failure. 2024-09-04 08:44:09.370+0000 WARN [o.n.k.i.c.VmPauseMonitorComponent] Detected VM stop-the-world pause: {pauseTime=154, gcTime=0, gcCount=0}

My Environment

Javascript Runtime Version: v16.17.0 Driver Version: 6.9.14 Neo4j Version and Edition: 4.2.19 community Operating System: Windows 11

MaxAake commented 1 month ago

Hello @studentemmyeze !

Thank you for providing the code behind your error, however I am unable to reproduce it. There is no driver version 6.9.14, could you double check what version of the driver you are running and let me know, that way we may be able to assist further.

How are you hosting your database, is it possible that the different setups simply have differing passwords set?