SDK: https://affiliate-program.amazon.com/creatorsapi/docs/en-us/get-started/...

I work on porting this contrib: https://www.drupal.org/project/amazon_pa

  • Amazon has an official SDK for its api. 
  • I loaded the sdk into my module and it works so far.
  • The SDK uses own stuff installed by composer

Loading is simple:

  $lib_path = __DIR__ . '/amazon_sdk/creatorsapi-php-sdk/vendor/autoload.php';
  if (file_exists($lib_path)) {
    require_once $lib_path;
  }

When i visit the "drupal status report page" and on "page saving settings" and on some other pages the site will full crash. 

Without the SDK in place it works. I am pretty sure that this is again because of the SDK using own libs that kind of get into problems with drupals /vendor

The sdk has this structure, and also loads somy synfony components

https://imgur.com/wK3cNbA

Any ideas on how i could handle that.

LOG:

PHP Fatal error:  Declaration of Drupal\\Core\\Update\\UpdateRegistry::getSubscribedEvents() must be compatible with Symfony\\Component\\EventDispatcher\\EventSubscriberInterface::getSubscribedEvents(): array in /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/Update/UpdateRegistry.php on line 385\nStack trace:\n#0 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/vendor/composer/ClassLoader.php(576): include()\n#1 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/vendor/composer/ClassLoader.php(427): {closure:Composer\\Autoload\\ClassLoader::initializeIncludeClosure():575}()\n#2 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Component/DependencyInjection/Container.php(261): Composer\\Autoload\\ClassLoader->loadClass()\n#3 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Component/DependencyInjection/Container.php(179): Drupal\\Component\\DependencyInjection\\Container->createService()\n#4 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal.php(195): Drupal\\Component\\DependencyInjection\\Container->get()\n#5 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/modules/system/system.install(941): Drupal::service()\n#6 [internal function]: system_requirements()\n#7 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): call_user_func_array()\n#8 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(395): Drupal\\Core\\Extension\\ModuleHandler->{closure:Drupal\\Core\\Extension\\ModuleHandler::invokeAll():415}()\n#9 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(415): Drupal\\Core\\Extension\\ModuleHandler->invokeAllWith()\n#10 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/modules/system/src/SystemManager.php(109): Drupal\\Core\\Extension\\ModuleHandler->invokeAll()\n#11 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/modules/system/src/Controller/SystemInfoController.php(53): Drupal\\system\\SystemManager->listRequirements()\n#12 [internal function]: Drupal\\system\\Controller\\SystemInfoController->status()\n#13 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()\n#14 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/Render/Renderer.php(637): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber::wrapControllerExecutionInRenderContext():121}()\n#15 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\\Core\\Render\\Renderer->executeInRenderContext()\n#16 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()\n#17 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->{closure:Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber::onController():96}()\n#18 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()\n#19 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\\Component\\HttpKernel\\HttpKernel->handle()\n#20 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\\Core\\StackMiddleware\\Session->handle()\n#21 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle()\n#22 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\\Core\\StackMiddleware\\ContentLength->handle()\n#23 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\\big_pipe\\StackMiddleware\\ContentLength->handle()\n#24 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\\page_cache\\StackMiddleware\\PageCache->pass()\n#25 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\\page_cache\\StackMiddleware\\PageCache->handle()\n#26 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle()\n#27 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle()\n#28 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\\Core\\StackMiddleware\\AjaxPageState->handle()\n#29 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\\Core\\StackMiddleware\\StackedHttpKernel->handle()\n#30 /srv/http/WORKSPACE_DRUPAL/EIGENE_PROJEKTE/PRODUCT_DISTRI_D14/web/index.php(19): Drupal\\Core\\DrupalKernel->handle()\n#31 {main},

Comments

jaypan’s picture

I'm thinking it may be because you've added this:

  $lib_path = __DIR__ . '/amazon_sdk/creatorsapi-php-sdk/vendor/autoload.php';
  if (file_exists($lib_path)) {
    require_once $lib_path;
  }

If you've included the SDK using composer (composer require [LIBRARY])  you don't need to add code to autoload the SDK. Composer will handle the autoloading for you, so I'm thinking trying to add it again may be causing fatal errors.

Contact me to contract me for D7 -> D10/11 migrations.

marcoka’s picture

Hi jaypan,

thank you for that thought.

the sdk sadly has no repository so it was (and can not) be uncluded with composer.

jaypan’s picture

Here is the composer package for the amazon SDK: https://packagist.org/packages/aws/aws-sdk-php.

The composer package will include the following Github library for your module: https://github.com/aws/aws-sdk-php

You'll need to included it as a requirement in the module's composer.json file: "require": {"aws/aws-sdk-php": "^3"}.

Contact me to contract me for D7 -> D10/11 migrations.

marcoka’s picture

Thanks but this is the AWS SDK, i am talking about the creator API.

jaypan’s picture

You wrote Amazon SDK in your original post, so maybe you could edit it and put a link to the creater API you are referring to.

Contact me to contract me for D7 -> D10/11 migrations.

marcoka’s picture

Sorry, my bad. Added everything.

jaypan’s picture

Here is a composer package for the SDK: https://packagist.org/packages/dbosen/creatorsapi-php-sdk

Which installs this library: https://github.com/dbosen/creatorsapi-php-sdk

Contact me to contract me for D7 -> D10/11 migrations.