401 Unauthorized Error via TypeScript Driver despite valid credentials on Aura Console
TACO
Subject: Inquiry regarding 401 Unauthorized error in Neo4j TypeScript Driver
Dear Neo4j Aura Support Team,
I am writing to seek assistance with a connection issue I am encountering with my Neo4j Aura instance.
Issue Description: I am consistently receiving a 401 Unauthorized error when attempting to connect to my Aura database using the official neo4j-driver (TypeScript/Node.js).
Observed Behavior:
Web Console: I can successfully log in and verify my database status using my credentials (URI, Username, and Password) through the Aura web console without any issues.
Driver Connection: However, when I use the exact same credentials in my code, the connection fails with a 401 error during driver initialization or server info retrieval.
My Connection Setup:
typescript
const uri = process.env.NEO4J_URI; // e.g., neo4j+s://xxxx.databases.neo4j.io
const user = process.env.NEO4J_USERNAME; // e.g., 'neo4j'
const password = process.env.NEO4J_PASSWORD;
const driver = neo4j.driver(uri, neo4j.auth.basic(user, password));
Troubleshooting Done:
- Confirmed that the URI, username, and password do not have any leading or trailing whitespaces.
- Verified that the credentials work perfectly on the Aura web portal.
- Ensured the URI uses the neo4j+s protocol required for Aura.
Could you please provide feedback on whether this could be an issue with the Aura instance's internal state, account permissions, or if there is a specific configuration for the TypeScript driver that I might be missing?
I look forward to your guidance.
Best regards, TACO