将位置传递给 dialogflow.projects.agent.search 时出错

Error passing location to dialogflow.projects.agent.search

我想使用 Nodejs googleapis 包从特定数据区域获取用户的 Dialogflow 代理。当我将 europe-west2 传递给 dialogflow.projects.agent.search 时,出现以下错误:

400 - "Dialogflow server in 'us' received request for resources located in 'europe-west2.'"

当我使用 auth 和 api 版本启动 dialogflow 常量时,是否需要指定位置?我在 v2beta1.d.ts 中唯一提到的位置是 geoLocation,这里不适用。 like in this question asked here.

也没有提到 apiEndpoint

这是我的代码:

const dialogflow = await google.dialogflow({
  auth: oAuth2Client
  version: 'v2beta1'
  // declare location here as well?
})

try {
  const fetchAgentsResponse = await dialogflow.projects.agent.search({
    parent: `projects/-/locations/${location}`
  })
} catch (e) {
  throw e
  // receive the 400 error mentioned above
}

我编辑了 SessionsClient 的服务路径以在 detectIntent 调用之前获取机器人的位置。

SessionsClient.servicePath = `${location}-dialogflow.googleapis.com`