【问题标题】:Why is Dialogflow CX referencing gcloud's project (project-number)?为什么 Dialogflow CX 引用 gcloud 的项目(项目编号)?
【发布时间】:2021-12-07 20:46:10
【问题描述】:

我正在使用 Dialogflow CX Java SDK 来执行列表代理命令。当我尝试列出代理时,我得到了这个异常。

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

相关代码sn-p:

AgentsSettings agentsSettings = AgentsSettings.newBuilder().build();

AgentsClient client = AgentsClient.create(agentsSettings)
LocationName parent = LocationName.of("my project id", "US-CENTRAL1");
AgentsClient.ListAgentsPagedResponse agents = client.listAgents(parent);

任何帮助表示赞赏。

【问题讨论】:

  • 您是否尝试按照错误消息的建议启用 Dialogflow API?您可以通过转到“API 和服务”> 库 > 搜索“Dialogflow API”> 选择“启用”来执行此操作。还要确认一下,Dialogflow 引用的项目是您的实际项目吗?
  • 我的项目有一个完全不同的 id。错误消息中的 id 是 gcloud 的 GCP 项目。单击该链接会导致安全错误。
  • 另一个谜团是我有一个单独的 ES Java SDK 程序可以正常工作。
  • 您在运行代码时是否使用了不同的项目凭据?您还可以确认您创建的代理是否位于us-central1
  • 相同的信誉。代理是 us-central1。不太清楚发生了什么。

标签: dialogflow-cx


【解决方案1】:

此错误可能表明未正确设置 GOOGLE_APPLICATION_CREDENTIALS 和/或 GOOGLE_CLOUD_PROJECT 环境变量。查看Dialogflow CX Setup 文档可能会有所帮助。

【讨论】:

    猜你喜欢
    • 2020-10-03
    • 1970-01-01
    • 2018-08-12
    • 2016-04-08
    • 1970-01-01
    • 2015-03-24
    • 2012-06-30
    • 2019-01-24
    • 2014-04-17
    相关资源
    最近更新 更多