Skip to content

NLP example doesn't work in Cloud Shell #3252

Description

@jphalip

I'm getting this error:

Caused by: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Cloud Natural Language API has not been used in project 618104708054 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/language.googleapis.com/overview?project=618104708054 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

The project I'm using does have the API enabled. I have no idea what project 618104708054 is — that is not the project I'm using.

I've tried setting the GOOGLE_CLOUD_PROJECT environment variable to my project ID, but I still get the same error.

Any idea what might be causing this?

Activity

  1. jphalip commented on May 10, 2018

    @jphalip
    Author

    I'm getting the same error with the Translation API as well:

    Google Cloud Translation API has not been used in project 618104708054 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/translate.googleapis.com/overview?project=618104708054 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
    
  2. jphalip commented on May 10, 2018

    @jphalip
    Author

    Steps to reproduce:

    1. Open Cloud Shell

    2. git clone https://github.com/GoogleCloudPlatform/java-docs-samples

    3. cd java-docs-samples/translate

    4. mvn package

  3. yihanzhen commented on May 18, 2018

    @yihanzhen
    Contributor

    Hi @jphalip ,
    Just want to have a quick check with you before I investigate further, did you set up the API key as is mentioned here?

  4. self-assigned this
    on May 18, 2018
  5. jphalip commented on May 19, 2018

    @jphalip
    Author

    Hi @hzyi-google, if I create an API key and set the GOOGLE_API_KEY variable, I'm now seeing this:

    WARNING: Ignoring API key set in environment variable GOOGLE_API_KEY: using Application Default Credentials instead.
    

    ... followed by the same error as originally reported, i.e. that the API isn't enabled for project 618104708054. I'm still not sure what project that number refers to.

  6. yihanzhen commented on May 21, 2018

    @yihanzhen
    Contributor

    @jphalip thanks for the update. I'll keep investigating.

  7. kurtisvg commented on May 23, 2018

    @kurtisvg
    Contributor

    Hi @jphalip,

    It looks like you are having issues with authentication. There is a detailed breakdown here, but the quick version is that the client library is inspecting the GOOGLE_APPLICATION_CREDENTIALS variable for some credentials (this variable supersedes the GOOGLE_API_KEY variable, which is why you are receiving a warning).

    Could you try running the following in the cloud shell terminal and see if authentication works:

    unset GOOGLE_APPLICATION_CREDENTIALS
    gcloud auth application-default login
    
  8. yihanzhen commented on May 24, 2018

    @yihanzhen
    Contributor

    Hi @jphalip,

    The service account set up in README under language samples should be able to fix the auth issue for both language and translate. Please let us know if that works for you. GOOGLE_API_KEY did not work for me either, I'll follow up with cloud shell team on that.

  9. yihanzhen commented on Jun 4, 2018

    @yihanzhen
    Contributor

    An internal bug has been filed to track the issue that GOOGLE_API_KEY does not work. Closing it here. Feel free to ask for reopen is there are still problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

api: languageIssues related to the Cloud Natural Language API API.auth

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions