Comments (5)
@lalitkumar-pal-drishya, could you share information about your environment (JS Runtime, Driver version, Neo4j Version, etc) and share some logs? This error is quite general and it can be generated by a bunch of different situations. So, you will need to look through the logs or through the error cause (which are available since Neo4j Driver version 5.0.0 and Node version 16.9.0).
Alternatively, you can swap you protocol from neo4j
to bolt
(or neo4j+s
to bolt+s
, if encrypted) for getting a more detailed message.
from neo4j-javascript-driver.
@bigmontz
Javascript Runtime Version: 18.x
Driver Version: 4.0.3
Neo4j Version and Edition: 5 Enterprize edition.
driver function code
export async function getDriver() {
let username;
let password;
let connection_string;
if (process.env.LOCAL == 'true') {
username = process.env.USER_NAME;
password = process.env.PASSWORD;
connection_string = process.env.CONNECTION_STRING;
} else {
const secrets = await get_secrets();
username = secrets.username;
password = secrets.password;
connection_string = secrets.connection_string;
}
return neo4j.driver(connection_string, neo4j.auth.basic(username, password), {
maxConnectionLifetime: 60 * 60 * 100000, // 1 hour
maxConnectionPoolSize: 100,
encrypted: 'ENCRYPTION_OFF',
});
}
database creation code
export async function create_new_database(plant_id) {
if (plant_id == '' || plant_id == null) {
return {
success: false,
error: 'Invalid input',
};
}
const database_name = 'db' + plant_id.replace(/[^a-zA-Z0-9\s]/g, '');
const driver = await getDriver();
const session = await get_default_database_session(driver);
const result = await session.run('SHOW DATABASES');
const database_list = [];
let status;
result.records.forEach((record) => {
database_list.push(record._fields[0]);
});
if (database_list.includes(database_name)) {
logger.info(`Database ${database_name} already exists`);
status = {
success: true,
database_name: database_name,
};
} else {
try {
await session.run(`CREATE DATABASE ${database_name}`);
logger.info(`Created database ${database_name}`);
status = {
success: true,
database_name: database_name,
};
} catch (err) {
logger.error(
`Error creating new database ${database_name} error: ${err}`,
);
status = {
success: false,
error: err,
};
}
}
await closeSession(session);
await closeDriver(driver);
return status;
}
session code
export async function getSession(driver, plant_id) {
const database_name = 'db' + plant_id.replace(/[^a-zA-Z0-9\s]/g, '');
let session;
try {
if (driver)
session = driver.session({
database: database_name,
});
else session = (await getDriver()).session({ database: database_name });
} catch (err) {
logger.error(err);
session = (await getDriver()).session({
database: database_name,
});
}
return session;
}
logs
I'm getting this error when setting maxConnectionPoolSIze as 1:
Connection acquisition timed out in 60000 ms. Pool status: Active conn count = 1, Idle conn count = 0.
And if I'm setting the maxConnectionPoolSIze greater than 1, we are getting this error:
{
"errorType": "Neo4jError",
"errorMessage": "Could not perform discovery. No routing servers available. Known routing table: RoutingTable[database=dbedcd75b117214a23950970bcb52c1df7, expirationTime=0, currentTime=1699275169006, routers=[], readers=[], writers=[]]",
"trace": [
"Neo4jError: Could not perform discovery. No routing servers available. Known routing table: RoutingTable[database=my_database, expirationTime=0, currentTime=1699275169006, routers=[], readers=[], writers=[]]",
"",
" at captureStacktrace (/var/task/node_modules/neo4j-driver-core/lib/result.js:239:17)",
" at new Result (/var/task/node_modules/neo4j-driver-core/lib/result.js:59:23)",
" at Session._run (/var/task/node_modules/neo4j-driver-core/lib/session.js:174:16)",
" at Session.run (/var/task/node_modules/neo4j-driver-core/lib/session.js:139:21)",
" at /var/task/src/ingest_plant/create_pid.mjs:17:13",
" at /var/task/node_modules/p-limit/index.js:23:31",
" at run (/var/task/node_modules/p-limit/index.js:23:43)",
" at /var/task/node_modules/p-limit/index.js:45:20",
" at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"
]
}
from neo4j-javascript-driver.
For enabling the logs in driver, you must:
const driver = neo4j.driver(theconnectionstring, theauth, {
...theOtherConfigs,
logging: neo4j.logging.console('debug')
})
I recommend you update the driver to 5.14.0
. The version 4.0.x of the driver is not homologated to work with the database 5
. If you have to use the version 4.x of the driver because of compatibility issues with existing codebase, you might use the version 4.4.11
.
from neo4j-javascript-driver.
Hey @lalitkumar-pal-drishya, did you update the driver? Did it solve the issue?
from neo4j-javascript-driver.
Issues closed due inactivity. Please, feel free to re-open the ticket in case of new evidences.
from neo4j-javascript-driver.
Related Issues (20)
- getServerInfo() not being awaited properly HOT 4
- `Time` and `LocalTime` types lack method `.toStandardDate()` HOT 1
- [Bug] Neo4jError: Ignored either because of an error or RESET HOT 8
- time consumed in neo4j browser for a query is ~20ms, while using the driver facing a huge increase in time ~370ms. HOT 3
- Impossible to connect to Aura-hosted database HOT 2
- Error connecting Neo4j 5.6 with neo4j-driver-bolt-connection 5.8.0 HOT 1
- Different situations on different browser HOT 2
- [Bug] `parseDatabaseUrl` removes path from URL HOT 12
- Datetime function timezone issue HOT 2
- Fatal JavaScript out of memory: Ineffective mark-compacts near heap limit HOT 1
- [HELP] Type 'T' does not satisfy the constraint 'Dict'. HOT 4
- ypeError: Cannot read properties of undefined (reading 'startsWith') HOT 2
- sessionExpired errors when using the driver from nodeJS to aura HOT 7
- :auto statement not working HOT 2
- Routing table never fresh with null (default) database name HOT 1
- Connection attempts time out when connecting using Bun HOT 7
- How to disable wss request,just use ws HOT 1
- Add release notes to Github releases HOT 3
- Enabling node.js source maps increases neo4j-driver total execution time by 70x+ on my machine HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neo4j-javascript-driver.