Neo4jError: Invalid input 'N': expected whitespace, comment, '{', node

I am trying to create a relation at the same time I create a node. I am using javascript neo4j driver.
When I run the query in neo4j desktop it works but not when using the driver.

session.run(`
                          match (a:Node1) where a.name = "Jon Doe"
                         create (b:Node2)<-[r:Reln]-(a) 
                         set b.name = ${args.name}
                         return a,b,r
                     `)

Hi,

can you try to use proper parameters in your cypher like $name and pass them as a map ot the driver?
(same for your literal "Jon Doe" value.)

please also share the full error message that should contain the query that Cypher sees.

I guess i your case you would have needed to use "${args.name}" so that there are quotes around your string.

1 Like

Thank you very much.. such a silly mistake from my part...