apoc.load.json treats windows filepath as relative no matter what
Guidelines
Following this official video: https://www.youtube.com/watch?v=iyjgOR7nBck In neo4j desktop execute this:
call apoc.load.json('C:/Users/user/Desktop/openAlexConcepts/conceptsAll.json') YIELD value RETURN value LIMIT 10
Expected Behavior
A series of dictionaries returned.
Actual Behavior (Mandatory)
Neo.ClientError.Procedure.ProcedureCallFailed
Failed to invoke procedure `apoc.load.json`: Caused by: java.io.IOException: Cannot open file C:\Users\user\.Neo4jDesktop\relate-data\dbmss\dbms-e96d02e2-cf3a-42bf-89f0-1f9608860ce6\import\Users\user\Desktop\openAlexConcepts\conceptsAll.json for reading.
Screenshots (where it's possibile)
I don't know. To me filepath I provide looks literally the same as one shown as example in error message above. But it is treated as relative path.
Versions
- OS: Windows 11
- Neo4j: DBMS 5.12.0
- Neo4j-Apoc: APOC 5.12.0
@Podbrushkin I think you have done the correct adaptation according to the error message. The new error message is not about the same thing but seems to indicate that your Neo4j user is not allowed to read from that place in the file system. This is something you need to configure on your own computer most likely.
The filepath in the error message is not the same as in the query. The one in the error message has the standard Neo4j import folder prefixed to it. So something is indeed off — at least on Windows.
It would be good to know what the setting for
server.directories.import
in neo4j.conf
and for
apoc.export.file.enabledapoc.import.file.enabledapoc.import.file.use_neo4j_config
in apoc.conf were.
I don't use Neo4j Desktop anymore, but I was able to reproduce this issue on Neo4j 5.22.0 + APOC 5.22.0 :
Absolute path without drive
CALL apoc.load.json('/users/user/desktop/delmeNodes.json') YIELD value RETURN value LIMIT 10
results in
Neo.ClientError.Procedure.ProcedureCallFailed
Failed to invoke procedure `apoc.load.json`: Caused by: java.io.IOException: Cannot open file C:\Users\user\AppData\Local\Programs\neo4j-community-5.22.0\import\users\user\desktop\delmeNodes.json for reading.
Absolute path with drive and prefix
CALL apoc.load.json('file:c:/users/user/desktop/delmeNodes.json') YIELD value RETURN value LIMIT 10
Neo.ClientError.Procedure.ProcedureCallFailed
Failed to invoke procedure `apoc.load.json`: Caused by: java.io.IOException: Cannot open file C:\Users\user\AppData\Local\Programs\neo4j-community-5.22.0\import\users\user\desktop\delmeNodes.json for reading.
apoc.conf has only these two lines:
apoc.export.file.enabled=true
apoc.import.file.enabled=true
And in neo4j.conf server.directories.import=import is active (not commented out).