It works fine in Google Cloud Shell, but when I try to reproduce it on my mac, I keep getting an error. The whole list of commands to reproduce it here:
git clone https://github.com/GoogleCloudPlatform/php-docs-samples.gitcd dialogflowgcloud config set project is-chatbot-gamma-wppq
gcloud auth login
Authorized through Chrome window, status 'You are now logged in as [ekapatsa@infostart.ru]'
And the final one, intent detection throws an error:
php dialogflow.php detect-intent-texts test2-cpfv "Заявка на абонемент"
The full output:
`Session path: projects/test2-cpfv/agent/sessions/61557f051cb62
PHP Fatal error: Uncaught Error: Call to a member function getDisplayName() on null in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php:53
Stack trace:
3 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Applicat in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php on line 53
Fatal error: Uncaught Error: Call to a member function getDisplayName() on null in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php:53
Stack trace:
3 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Applicat in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php on line 53`
Line 53 of 'detect-intent-texts.php:
$displayName = $intent->getDisplayName();
It works fine in Google Cloud Shell, but when I try to reproduce it on my mac, I keep getting an error. The whole list of commands to reproduce it here:
git clone https://github.com/GoogleCloudPlatform/php-docs-samples.git
cd dialogflow
gcloud config set project is-chatbot-gamma-wppq
gcloud auth login
Authorized through Chrome window, status 'You are now logged in as [ekapatsa@infostart.ru]'gcloud config set project test2-cpfv
gcloud projects add-iam-policy-binding test2-cpfv --member="serviceAccount:serviceaccount@test2-cpfv.iam.gserviceaccount.com" --role="roles/owner"
export GOOGLE_APPLICATION_CREDENTIALS="/Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/test2-cpfv-29ac10213682.json"
composer install
And the final one, intent detection throws an error:
php dialogflow.php detect-intent-texts test2-cpfv "Заявка на абонемент"
The full output: `Session path: projects/test2-cpfv/agent/sessions/61557f051cb62 PHP Fatal error: Uncaught Error: Call to a member function getDisplayName() on null in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php:53 Stack trace:
0 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/dialogflow.php(56): Google\Cloud\Samples\Dialogflow\detect_intent_texts('test2-cpfv', Array, NULL, 'en-US')
1 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Command/Command.php(297): Closure->Google\Cloud\Samples\Dialogflow{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
2 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Application.php(978): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
3 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Applicat in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php on line 53
Fatal error: Uncaught Error: Call to a member function getDisplayName() on null in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php:53 Stack trace:
0 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/dialogflow.php(56): Google\Cloud\Samples\Dialogflow\detect_intent_texts('test2-cpfv', Array, NULL, 'en-US')
1 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Command/Command.php(297): Closure->Google\Cloud\Samples\Dialogflow{closure}(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
2 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Application.php(978): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
3 /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Applicat in /Users/helenkapatsa/Repositories/php-docs-samples/dialogflow/src/detect_intent_texts.php on line 53`
Line 53 of 'detect-intent-texts.php:
$displayName = $intent->getDisplayName();
What can I do?