Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apoc.load.json treats windows filepath as relative no matter what #505

Open
Podbrushkin opened this issue Oct 6, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@Podbrushkin
Copy link

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)

image

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
@Lojjs
Copy link
Contributor

Lojjs commented Oct 16, 2023

@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.

@hvub hvub added the bug Something isn't working label Dec 18, 2024
@hvub
Copy link
Collaborator

hvub commented Dec 18, 2024

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.enabled
  • apoc.import.file.enabled
  • apoc.import.file.use_neo4j_config

in apoc.conf were.

@Podbrushkin
Copy link
Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants