cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

JS Neo4jError: Cannot run query in this transaction, because it has been rolled back either because of an error or explicit termination

I fire few hundreds of below mentioned query concurrently (tried synchronously also) from JS neo4j-driver 4.4.1. Few of the queries, sometimes throws the following error in nodejs. But when my retry logic retries after sometime, it works.

Query

MERGE (n0:Movie {movie_id: $movie_id})
        WITH n0
        CALL apoc.lock.nodes([n0])
        CALL {
            WITH n0
            WITH n0 WHERE n0.updated_at IS NULL OR n0.updated_at < datetime($updated_at)
            MERGE (n:Movie {movie_id: $movie_id})
            ON CREATE SET n.movie_id = $movie_id
            SET n.name = $name
            SET n.downloads = $downloads
            SET n.updated_at = datetime($updated_at)
            RETURN count(*) AS cnt
        }
        RETURN n0, cnt

I run this query in separate transactions like below.

const session = driver.session();
await session.writeTransaction(async tx => {
                   return await tx.run(QUERY, {args}); 
                });

Log
Neo4jError: Cannot run query in this transaction, because it has been rolled back either because of an error or explicit termination.

I couldn't find any trace related to that query in neo4j logs.

Can anyone guide me with this.

0 REPLIES 0