cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to invoke procedure `apoc.nlp.gcp.entities.stream`: Caused by: java.io.IOException

rajeev1_s
Node

Hi,
I am using desktop version of Neo4j 4.0.3 with GDS and APOC (apoc-4.0.0.12-all.jar & apoc-nlp-dependencies-4.0.0.12.jar) plugins.
I issue following command in Cypher
MATCH (a:Article {uri: "https://neo4j.com/blog/pokegraph-gotta-graph-em-all/"})
CALL apoc.nlp.gcp.entities.stream(a, {
key: '',
nodeProperty: "body"
})
YIELD value
UNWIND value.entities AS entity
RETURN entity;

Whenever I execute the above command, I receive the following error:

Neo.ClientError.Procedure.ProcedureCallFailed

Failed to invoke procedure apoc.nlp.gcp.entities.stream: Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://language.googleapis.com/v1/documents:analyzeEntities?key=

I have the API key setup in my project and also enabled services in GCP project
NAME TITLE
endpoints.googleapis.com Google Cloud Endpoints
servicecontrol.googleapis.com Service Control API
servicemanagement.googleapis.com Service Management API

Please help in resolving the above issue.

Thanks & Regards,
Rajeev

13 REPLIES 13

mark_needham
Neo4j
Neo4j

I think that error code is an auth based one. Is the key that it shows in the error message the one that you expect to see?

Maybe check if the api key you are using has any set limitations?

I am encountering a somewhat similar issue, but mine is 400 error code. The query runs OK every now and then, So i am sure that the apikey is correct. But every so often, i get the error message:

"Failed to invoke procedure apoc.nlp.gcp.entities.stream: Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://language.googleapis.com/v1/documents:analyzeEntities?

Anyone with clue as to what I need to do to fix this?

Update:
the string that was triggering the errors:
"General Medicine"
"Molecular Medicine"

I replaced the " " with a "-" in front of "Medicine" and the HTTP 400 error went away:
trim(toUpper(replace(n.Title," Medicine","-Medicine" )))

Weird!!

Do you mean having those phrases in the node property that you're analyzing causes the error? That sounds very weird, I'd like to investigate it so that we can sort it out

Failed to invoke procedure apoc.nlp.gcp.entities.stream: Caused by: java.io.IOException: Server returned HTTP response code: 400
i do have a same issue can any one help me with this

Is it repeatable? Can you share the data/query that resulted in that error?

MATCH (a:Article {uri: "https://neo4j.com/blog/pokegraph-gotta-graph-em-all/"})
CALL apoc.nlp.gcp.entities.graph(a, {
key: $apiKey,
nodeProperty: "body",
writeRelationshipType: "ENTITY"
})
YIELD graph AS g
RETURN g;

mark_needham
Neo4j
Neo4j

Oh that's strange. I just created a new guide showing how to use the procedures so I have tested out something very similar to that query - https://neo4j.com/developer/graph-data-science/nlp/entity-extraction/

Does your API key definitely have all the required permissions?

yes i do can u please help me with creating the relation between the nodes dynamicaly for a given text and also i dint get same version of graphware nlp's in the git hub i need 3.5.1 version of standford nlp can u me help me with this please..

Hi Mark,

I have the same error as rajeev1.s
Failed to invoke procedure apoc.nlp.gcp.entities.stream: Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://language.googleapis.com/v1/documents:analyzeEntities?key=(key here)

However, I it is unclear which permissions the API key needs to have. I'm following this tutorial (https://neo4j.com/developer/graph-data-science/build-knowledge-graph-nlp-ontologies/) and the explanation is quite brief (Assuming that we’re already created a GCP account, we can generate a key by following the instructions at console.cloud.google.com/apis/credentials). Could you provide me with the steps necessary to check if the API key has all the required permissions?

For now, I don't have any restrictions.

Thanks,
Rose

cekohlbrenner
Node Link

@rosemary.thatsme I had the same issue. Try visiting https://console.developers.google.com/apis/api/language.googleapis.com/overview?project=YOUR-GCP-PROJECT-ID to enable it.

(Below is how I figured that out, by calling the GCP natural language API from the command line)

$ curl  -XPOST 'https://language.googleapis.com/v1/documents:analyzeEntities?key=MY-API-KEY  
{
  "error": {
    "code": 403,
    "message": "Cloud Natural Language API has not been used in project *MY-PROJECT-ID* before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/language.googleapis.com/overview?project=*MY-PROJECT-ID* then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developers console API activation",
            "url": "https://console.developers.google.com/apis/api/language.googleapis.com/overview?project=*MY-PROJECT-ID*"
          }
        ]
      },
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "SERVICE_DISABLED",
        "domain": "googleapis.com",
        "metadata": {
          "consumer": "projects/*MY-PROJECT-ID*",
          "service": "language.googleapis.com"
        }
      }
    ]
  }
}

After enabling it, I was able to continue with the Neo4j tutorial (Tutorial: Build a Knowledge Graph using NLP and Ontologies - Developer Guides)

asalalikhani
Node Link

Hi,
I am using desktop version of Neo4j 4.4.7 with (apoc-4.4.0.5.jar & apoc-nlp-dependencies-4.0.0.18.jar & n10s-4.4.0.1.jar & graph-data-science-2.0.4.jar & neo4j-jwt-addon-1.2.0.jar) plugins.
When I execute following Cypher code:

 

CALL apoc.nlp.gcp.entities.stream(a, {
nodeProperty: 'body',
key: $key
})
YIELD node, value
SET node.processed = true
WITH node, value
UNWIND value.entities AS entity
RETURN entity
LIMIT 5;
 
The following error occurs. 
 
Failed to invoke procedure `apoc.nlp.gcp.entities.stream`: Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: https://language.googleapis.com/v1/documents:analyzeEntities?key=AIzaSyAz-U.....
 
Please help me to solve this Issue.
Thanks
Asal

fan_123
Node Link

same issue here, it seems that this problem hasn't been solved for two years..

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.