Hi,

I've attempted several times to install the Cognito module on a clean Drupal 8 install (on Pantheon) and I'm constantly getting the following error using both 8.x-1.0-beta2 and 8.x-1.x-dev:

Error: Class 'Aws\CognitoIdentityProvider\CognitoIdentityProviderClient' not found in Drupal\cognito\Aws\CognitoIdentityProviderClientFactory::create() (line 28 of /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/modules/contrib/cognito/src/Aws/CognitoIdentityProviderClientFactory.php) #0 [internal function]: Drupal\cognito\Aws\CognitoIdentityProviderClientFactory::create(Array) #1 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Component/DependencyInjection/Container.php(255): call_user_func_array(Array, Array) #2 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'cognito.cognito...') #3 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Component/DependencyInjection/Container.php(487): Drupal\Component\DependencyInjection\Container->get('cognito.cognito...', 1) #4 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) #5 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'cognito.aws') #6 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/modules/contrib/cognito/src/Form/Email/UserLoginForm.php(72): Drupal\Component\DependencyInjection\Container->get('cognito.aws') #7 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php(28): Drupal\cognito\Form\Email\UserLoginForm::create(Object(Drupal\Core\DependencyInjection\Container)) #8 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/Controller/HtmlFormController.php(48): Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition('\\Drupal\\cognito...') #9 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/Controller/FormController.php(78): Drupal\Core\Controller\HtmlFormController->getFormObject(Object(Drupal\Core\Routing\RouteMatch), '\\Drupal\\cognito...') #10 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #11 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #12 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #13 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #14 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #15 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #16 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #17 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /srv/bindings/34906149f3884c289c0198c8fe1aadb9/code/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #27 {main}.

This is the error that shows up in the error log when attempting to load /user/login in a browser while I'm not logged in. I've uploaded the full module folder Cognito and it appears that all of the files are present.

I can't figure out if this is something I'm doing wrong in the installation process, or whether there is a problem with the module (or with compatibility on the Pantheon platform).

I've installed both Cognito and ExternalAuth and I've added the following to my settings.php file (with the 'xxxx' values replaced with the appropriate values):

$settings['cognito'] = [
  'region' => 'us-west-2',
  'credentials' => [
    'key' => 'xxxx',
    'secret' => 'xxxx',
  ],
  'user_pool_id' => 'xxxx',
  'client_id' => 'xxxx',
];

It is certainly possible that have some kind of misconfiguration on the Cognito end, but I'd be a bit surprised if it manifested itself as en error on the Drupal side as is currently happening.

Any troubleshooting support you can provide would be appreciated.

Thanks,
Erik.

Comments

erikhopp created an issue. See original summary.

benjy’s picture

Can you confirm what version of the aws dependencies you get? Should be "aws/aws-sdk-php": "~3.32",

erikhopp’s picture

Status: Active » Fixed

Thanks for the response @benjy.

I'm still getting my head around Drupal 8 and I hadn't actually installed the dependencies for the Cognito module. Once I pulled the site down to my local environment and installed the module with 'composer require drupal/cognito' and then committed and pushed it back to the server, it worked.

Sorry for the noise. Marking fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

benjy’s picture