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.custom.declareFunction does not work with APOC 4.4.0.4 #2880

Closed
jkolster opened this issue May 11, 2022 · 5 comments
Closed

apoc.custom.declareFunction does not work with APOC 4.4.0.4 #2880

jkolster opened this issue May 11, 2022 · 5 comments

Comments

@jkolster
Copy link

I have the following issue with APOC 4.4.0.4

When running the following example code (https://neo4j.com/labs/apoc/4.2/overview/apoc.custom/apoc.custom.declareFunction/#usage-apoc.custom.declareFunction) using the latest APOC 4.4.0.4 library:

CALL apoc.custom.declareFunction(
'double(input::INT) :: INT',
'RETURN $input*2 as answer'
);

I expect the function 'double' to be created without issues.

But when I run this statement I get the following error:

Neo.ClientError.Procedure.ProcedureCallFailed
Failed to invoke procedure apoc.custom.declareFunction: Caused by: org.neo4j.exceptions.SyntaxException: Type mismatch for parameter 'input': expected Float, Integer or Duration but was String (line 1, column 16 (offset: 15))
"EXPLAIN RETURN $input*2 as answer"

This issue does NOT occur when using APOC version 4.4.0.3!!!
Could you please fix this issue?

Versions used

  • OS: MacOS 12.3.1
  • Neo4j: 4.4.5
  • Neo4j-Apoc: 4.4.0.4
@vga91
Copy link
Collaborator

vga91 commented May 12, 2022

@jkolster
The bug is solved through this pr #2702,
which has yet to be merged and released in 4.4.

While waiting for the release (and to be sure this works for you too), can you try with this attached zipped-jar?

apoc-4.4.0.5-all.jar.zip

@ralphavalon
Copy link

I'm facing the same problem and tried to use APOC 4.4.0.5 and it didn't work neither with Neo4j 4.4.5 or 4.4.7

Here's how to reproduce it:

version: '3'
services:
  neo4j:
    image: neo4j:4.4.7
    hostname: neo4j
    ports:
      - "7474:7474"
      - "7687:7687"
    environment:
      - NEO4J_AUTH=neo4j/test
      - NEO4J_dbms_logs_debug_level=DEBUG
      - NEO4JLABS_PLUGINS=["apoc"]
      - NEO4J_dbms_security_procedures_whitelist=apoc.*
      - NEO4J_dbms_security_procedures_unrestricted=apoc.*

Then, just login into http://localhost:7474/browser and run:

CALL apoc.custom.declareFunction(
'double(input::INT) :: INT',
'RETURN $input*2 as answer'
);

It was tested with:

Neo4j: 4.4.5 and 4.4.7
APOC: 4.4.0.5

@vga91
Copy link
Collaborator

vga91 commented May 24, 2022

@ralphavalon Yes, the fix for apoc 4.4.x.x was merged yesterday (#2913) but not yet released

@ralphavalon
Copy link

@vga91 Hi, so I saw this was released on APOC 4.4.0.6 and I tested it.

It fixed this issue but two other issues happened (I'll just mention them here but I'll go to their respective pages to talk more about them):

1- I have some scripts that create some functions and they started to fail because now they need to be ordered (you can't create a function using another function that still doesn't exist). That's fine and it was fixed by reordering them, but I thought it was good at least to mention.

2- This issue happened #2605 for a lot of procedures. I'll post more details there.

But main point here is that the issue about declareFunction here was solved for me.

@vga91
Copy link
Collaborator

vga91 commented Oct 5, 2022

Fixed by #2702

@vga91 vga91 closed this as completed Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants