V. 4.0 compatible tutorial for user-defined procedures and functions

I'm new to Neo4j and jumping right in with v4.0. I would like to write a user-defined function that has READ access to the graph db. I followed the 3.5.x tutorial here.
It doesn't appear this tutorial works out of the box with v4.0. Are there examples of writing user-defined functions and tests for v4.0? Will this tutorial be updated for 4.0 compatibility?

I've gone back to 3.5.17 until the tutorial gets updated.

for 4.0 does the following suffice


Those docs are still incomplete for 4.0. The page for writing user-defined procedures just says "The full example is available in the Neo4j Procedure Template repository." But as we know, the template is for 3.5.

If you build that github project and drop the jar file into your v.4.0 plugins folder, the procedures just fail to load at all.

1 Like


I presume your dependency is configured for Neo4j 4.0?

Can you provide more details on the failure? Is a stack trace written to the neo4j.log / debug.log?

If I change the dependency in the pom file to 4.0.1, it won't even compile. There are just some straight up incompatibilities between 3.5 and 4.0 that break the example. I recommend following the tutorial so you can see what I'm referring to.
However, if I compile it with 3.5, everything works great out of the box on a 3.5 server.
If I compile it with 3.5 and try to use it on a 4.0 server, the user-defined functions work, but the procedures do not show up in dbms.procedures().
I did not keep the logs and I have since switched over to 3.5 because everything is working great. I would like to go back to 4.0 at some point in the future, and I recognize that I will have to port my code over for 4.0 compatibility at that point. But for now, things are fine.
I would just recommend that someone add an official UDF/Procedure example to work with 4.0 (in addition to the 3.5 example). Thanks.

1 Like

Your post encouraged me to downgrade based on very similar experiences. Already getting better results within about ten minutes using a transactioneventlistener. It wasn't loading in 4.0.4 and works great in 3.5.18.

I'm experiencing the same problem. I want to debug my user-defined procedure with already existing neo4j database. BUT I can't debug it. https://stackoverflow.com/q/62952768/3209523

I can run my procedure with existing neo4j database. Sometimes it gives errors. That's why I want to debug it with real data. I can debug it with mock data.