Skip to content

Commit

Permalink
fixes neo4j-contrib#2824: Extend the error message for export procedu…
Browse files Browse the repository at this point in the history
…res to also point out stream:true
  • Loading branch information
vga91 committed May 13, 2022
1 parent 0659adf commit 37bbfe9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion core/src/main/java/apoc/ApocConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public enum UuidFormatType { hex, base64 }
));
private static final String DEFAULT_PATH = ".";
private static final String CONFIG_DIR = "config-dir=";
public static final String EXPORT_TO_FILE_ERROR = "Export to files not enabled, please set apoc.export.file.enabled=true in your apoc.conf";
public static final String EXPORT_TO_FILE_ERROR = "Export to files not enabled, please set apoc.export.file.enabled=true in your apoc.conf.\n" +
"Otherwise, if you are running in a cloud environment without filesystem access, use the `{stream:true}` config and null as a 'file' parameter to stream the export back to your client.\n" +
"Note that the stream mode cannot be used with the apoc.export.xls.* procedures.";

private final Config neo4jConfig;
private final Log log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import static apoc.ApocConfig.APOC_EXPORT_FILE_ENABLED;
import static apoc.ApocConfig.APOC_IMPORT_FILE_ENABLED;
import static apoc.ApocConfig.EXPORT_TO_FILE_ERROR;
import static apoc.ApocConfig.apocConfig;
import static apoc.util.MapUtil.map;
import static apoc.util.TestUtil.isRunningInCI;
Expand Down Expand Up @@ -452,7 +453,7 @@ public void testExportGraphGraphMLTypesWithNoExportConfig() throws Exception {
} catch (QueryExecutionException e) {
Throwable except = ExceptionUtils.getRootCause(e);
TestCase.assertTrue(except instanceof RuntimeException);
assertEquals("Export to files not enabled, please set apoc.export.file.enabled=true in your apoc.conf", except.getMessage());
assertEquals(EXPORT_TO_FILE_ERROR, except.getMessage());
throw e;
}
}
Expand Down
4 changes: 3 additions & 1 deletion docs/asciidoc/modules/ROOT/partials/enableFileExport.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ apoc.export.file.enabled=true
If we try to use any of the export procedures without having first set this property, we'll get the following error message:

|===
| Failed to invoke procedure: Caused by: java.lang.RuntimeException: Export to files not enabled, please set apoc.export.file.enabled=true in your neo4j.conf
| Failed to invoke procedure: Caused by: java.lang.RuntimeException: Export to files not enabled, please set apoc.export.file.enabled=true in your apoc.conf.
Otherwise, if you are running in a cloud environment without filesystem access, use the `{stream:true}` config and null as a 'file' parameter to stream the export back to your client.
Note that the stream mode cannot be used with the apoc.export.xls.* procedures.
|===

Export files are written to the `import` directory, which is defined by the `dbms.directories.import` property.
Expand Down
4 changes: 3 additions & 1 deletion docs/asciidoc/modules/ROOT/partials/enableS3Export.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ apoc.export.file.enabled=true
If we try to use any of the export procedures without having first set this property, we'll get the following error message:

|===
| Failed to invoke procedure: Caused by: java.lang.RuntimeException: Export to files not enabled, please set apoc.export.file.enabled=true in your neo4j.conf
| Failed to invoke procedure: Caused by: java.lang.RuntimeException: Export to files not enabled, please set apoc.export.file.enabled=true in your apoc.conf.
Otherwise, if you are running in a cloud environment without filesystem access, you can use the `{stream:true}` config and null as a 'file' parameter to stream the export back to your client.
Note that the stream mode cannot be used with the apoc.export.xls.* procedures.
|===

== Using S3 protocol
Expand Down

0 comments on commit 37bbfe9

Please sign in to comment.