dialogflow / dialogflow-java-client-v2

Java client for Dialogflow: Design and integrate a conversational user interface into your applications and devices.
Apache License 2.0
59 stars 58 forks source link

No DesignTimeAgent found for project #33

Closed anatolyw closed 5 years ago

anatolyw commented 5 years ago

MacBook Pro (15-inch, 2017), macOS Mojave (Version 10.14.6), jdk1.8.0_161.jdk

Trying to run mvn clean verify on basic DetectIntentText profile brings me the following (project-id was replaced):

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.example.dialogflow.DetectIntentWithModelSelectionIT
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.782 s <<< FAILURE! - in com.example.dialogflow.DetectIntentWithModelSelectionIT
[ERROR] testDetectIntent(com.example.dialogflow.DetectIntentWithModelSelectionIT)  Time elapsed: 2.712 s  <<< ERROR!
com.google.api.gax.rpc.NotFoundException: io.grpc.StatusRuntimeException: NOT_FOUND: com.google.apps.framework.request.NotFoundException: No DesignTimeAgent found for project 'MY_PROJECT_ID'.
Caused by: io.grpc.StatusRuntimeException: NOT_FOUND: com.google.apps.framework.request.NotFoundException: No DesignTimeAgent found for project 'MY_PROJECT_ID'.

[INFO] Running com.example.dialogflow.IntentManagementIT
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.48 s <<< FAILURE! - in com.example.dialogflow.IntentManagementIT
[ERROR] testCreateIntent(com.example.dialogflow.IntentManagementIT)  Time elapsed: 0.48 s  <<< ERROR!
com.google.api.gax.rpc.NotFoundException: io.grpc.StatusRuntimeException: NOT_FOUND: Agent for project 'MY_PROJECT_ID' not found.
Caused by: io.grpc.StatusRuntimeException: NOT_FOUND: Agent for project 'MY_PROJECT_ID' not found.
...

same for other tests.

The same exception I have received in my spring-boot service. More details here: https://stackoverflow.com/questions/57359840/dialogflow-v2-java-client-library-detectintent-with-spring-boot-no-designtimeag

Any help is appreciated.

anatolyw commented 5 years ago

Also have tried with curl (based on example from https://cloud.google.com/dialogflow/docs/quickstart-api#detect-intent-text-drest), same error message:

curl -X POST \
-H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
https://dialogflow.googleapis.com/v2/projects/MY_PROJECT_ID/agent/sessions/123456789:detectIntent
{
  "error": {
    "code": 404,
    "message": "com.google.apps.framework.request.NotFoundException: No DesignTimeAgent found for project 'MY_PROJECT_ID'.",
    "status": "NOT_FOUND"
  }
}
anatolyw commented 5 years ago

OK, I have figured it out.

The above misleading error message was caused by the use of a wrong PROJECT_ID. My mistake was, that first I have created a new Project with a Service Account, gave to it dialogflow API rights and later I have tried to use its name and related PK JSON for my detectIntent calls. BUT it was not linked with Dialogflow Project ID.

So, to fix it I have started with a default Project ID, which was given to my new Dialogflow Agent and following instruction https://dialogflow.com/docs/reference/v2-auth-setup I have created a new Project with a Service Account which fit my Dialogflow Agent.

HcwXd commented 5 years ago

I had the same error message using bottender framework. It turned out to be that I didn't link my Dialogflow Agent to the GCP project. So I created a new Agent and everything worked fine.

I hope it can help someone with the same confusion :)

tgmerritt commented 4 years ago

Same issue here - the error message is really cryptic.

vishnureddy7 commented 3 years ago

I am also getting the same error, Did anyone solve this? google.api_core.exceptions.NotFound: 404 com.google.apps.framework.request.NotFoundException: No DesignTimeAgent found for project '<project-id>'.

AnirudhaGohokar commented 3 years ago

When you create a dialogflow agent say 'dialogflow-123' it also automatically creates project in IAM with same name as dialoglow-123. Use this project to create the service for dialogflow access

michaelpulis commented 2 years ago

When you create a dialogflow agent say 'dialogflow-123' it also automatically creates project in IAM with same name as dialoglow-123. Use this project to create the service for dialogflow access

I think the better option is to create a new bot, where you can choose the project you want to set it on. Set it to the project that you already have all your services on, and from the old bot press export from the settings and import into your new bot. This allows you to have an exact clone, but on the correct project.

hgopi commented 2 years ago

I had the same issue. In my case, I have deleted the Google Assistance responses and kept only the default one. It worked.