AWS 部署中的 Dialogflow 崩溃

Dialogflow Crash in AWS Deployment

我将相同的源代码部署到 AWS EC2 Linux 实例,但它无法显示来自 dialogflow 的响应文本。 我检查了 Dialogflow 控制台中的对话历史记录,它正确显示了请求和响应。但是,调用函数 "detectIntent" 后,dialogflow 客户端 (PHP) 似乎崩溃了。 不幸的是,无法找到任何日志。

重新安装了 Dialogflow 客户端库

  $formattedSession = $sessionsClient->sessionName($agent, $agentSession->session_id);
  // Set Text Input
  $textInput  = new TextInput();
  $textInput->setText($text);
  $textInput->setLanguageCode($lang);

  // Set Parameters
  $optionalArgs = array();

  $queryInput = new QueryInput();
  $queryInput->setText($textInput);

  $response = $sessionsClient->detectIntent($formattedSession, $queryInput, $optionalArgs);

  $action = $response->getQueryResult()->getAction(); //The action name from the matched intent.

希望以下经验对其他人有所帮助: 对于我的情况,php 版本与 Google API 库之一不兼容。因此它在我们无法捕获的地方崩溃了。 解决方案:卸载 PHP,并安装 php.

的兼容版本