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

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

Open
studentemmyeze opened this issue Sep 4, 2024 · 1 comment
Labels

Comments

@studentemmyeze
Copy link

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
Copy link
Contributor

MaxAake commented Sep 16, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants