undefined function GuzzleHttp\_idn_uri_convert()

Created on 19 March 2023, almost 2 years ago
Updated 18 September 2023, over 1 year ago

I get the following error when I try to test the module:

The website encountered an unexpected error. Please try again later.
Error: Call to undefined function GuzzleHttp\_idn_uri_convert() in GuzzleHttp\Client->buildUri() (line 220 of libraries/amazon_sdk/vendor/guzzlehttp/guzzle/src/Client.php).

GuzzleHttp\Client->buildUri() (Line: 113)
GuzzleHttp\Client->sendAsync() (Line: 130)
GuzzleHttp\Client->send() (Line: 422)
Amazon\ProductAdvertisingAPI\v1\com\amazon\paapi5\v1\api\DefaultApi->getItemsWithHttpInfo() (Line: 401)
Amazon\ProductAdvertisingAPI\v1\com\amazon\paapi5\v1\api\DefaultApi->getItems() (Line: 1647)
amazon_pa_getItems() (Line: 568)
amazon_pa_api_request() (Line: 695)
_amazon_pa_item_batch_lookup_from_web() (Line: 665)
amazon_pa_item_lookup_from_web() (Line: 96)
Drupal\amazon_pa\Form\AmazonPaTest->validateForm()
call_user_func_array() (Line: 82)
Drupal\Core\Form\FormValidator->executeValidateHandlers() (Line: 275)
Drupal\Core\Form\FormValidator->doValidateForm() (Line: 118)
Drupal\Core\Form\FormValidator->validateForm() (Line: 591)
Drupal\Core\Form\FormBuilder->processForm() (Line: 323)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Once I delete the lines which are the culprit the test works. However, running cron gives me like 10 pages of errors but only if I activate "Update ASIN field data on node view.":

Warning: Undefined array key "node" in _amazon_pa_field_update_nodes() (line 67 of modules/amazon_pa/amazon_pa.module)

without that option cron works fine.

Then, when I use tokens (e. g. [amazon:B005B01YPE:thumbnail]) in a node and save, I get this error:

The website encountered an unexpected error. Please try again later.
Error: Cannot use object of type Drupal\Core\Render\Markup as array in Drupal\amazon_pa_filter\Plugin\Filter\AmazonFilter->process() (line 293 of modules/amazon_pa/amazon_pa_filter/src/Plugin/Filter/AmazonFilter.php).
Drupal\amazon_pa_filter\Plugin\Filter\AmazonFilter->process() (Line: 118)
Drupal\filter\Element\ProcessedText::preRenderText()
call_user_func_array() (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 788)
Drupal\Core\Render\Renderer->doCallback() (Line: 374)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 87)
__TwigTemplate_e5b9730da48bbc843781931639e6d952b46abbb193029fcf7a812ad65c0f11ab->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 390)
Twig\Template->render() (Line: 55)
twig_render_template() (Line: 384)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 446)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 220)
__TwigTemplate_940aa5ec85d8795e85d016f15a60bea6937dce618d7f236992e93a3ff722fa6d->doDisplay() (Line: 405)
Twig\Template->displayWithErrorHandling() (Line: 378)
Twig\Template->display() (Line: 390)
Twig\Template->render() (Line: 55)
twig_render_template() (Line: 384)
Drupal\Core\Theme\ThemeManager->render() (Line: 433)
Drupal\Core\Render\Renderer->doRender() (Line: 204)
Drupal\Core\Render\Renderer->render() (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 243)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 174)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 191)
Drupal\page_cache\StackMiddleware\PageCache->fetch() (Line: 128)
Drupal\page_cache\StackMiddleware\PageCache->lookup() (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 718)
Drupal\Core\DrupalKernel->handle() (Line: 19) 
🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇨🇭Switzerland Castor-designs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Castor-designs
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇩🇪Germany marcoka

    Ah yes, dependecy war again.
    On the project page i wrote some Infos about that. You have to use the repeository from dww (the second maintainer)

    Install the SDK
    This module uses the official amazon php SDK that can be found here: https://webservices.amazon.com/paapi5/documentation/quick-start/using-sd...
    It uses libraries support, READ the INSTALL.txt!
    It turns out there is a guzzle dependecy problem and if we update to the latest sdk we get dependecy war BUT can not update because drupal core D9 doesnt use the latest guzzle. So you HAVE TO USE THE REPOSITORY DWW SET UP!

    Delete everything expect the src and vendor folder!es but i couldnt figure that out by now. Samples welcome, se issue queue.

  • 🇨🇭Switzerland Castor-designs

    Thanks marcoka

    Where do I find the repository dww set up? What I did was:

    1. Download paapi5-php-sdk-and-samples archive from the amazon.com page
    2. delete everything but src and vendor folder.
    3. put it on my webspace under /libraries/amazon_sdk
  • 🇩🇪Germany marcoka

    That was working before the dependency stuff caused by drupal updates.
    The dww repository can be found in the composer file of the D7 version. I currently have no time to dig it out.

  • 🇨🇭Switzerland Castor-designs

    Thanks marcoka. How do I find it? I install amazon_pa on a drupal 7 installation with composer and try to find the library and copy that over to the druapl 9 installation? I am a bit confused sorry. (In the file downloads the library is not present of course.)

  • 🇩🇪Germany marcoka

    Yea this really is a pain from external.
    This is the commit: https://git.drupalcode.org/project/amazon_pa/-/commit/3c6ba2200795345fd5...

    https://packagist.org/packages/ten7/amazon-paapi5-php-sdk

    In my case i downloaded it once, installed it the manual way. So it works and isn´t busted every other update somewhere dependency.
    That latest SDK also made problems here with the latest php 8.1 and needed to fork parts too...

    I attached the current sdk i use.
    https://www.drupal.org/files/issues/2023-03-24/amazon_sdk_mka.zip

  • 🇨🇭Switzerland Castor-designs

    Thank you very much @marcoka!
    I completely uninstalled the module and started again from scratch. I install the library you linked and then the latest Amazon module (Version: 2.1.0-beta12).
    However, I still get the following error in the backend and when visiting pages where I use amazon tokens:

    The website encountered an unexpected error. Please try again later.
    Error: Cannot use object of type Drupal\Core\Render\Markup as array in Drupal\amazon_pa_filter\Plugin\Filter\AmazonFilter->process() (line 293 of modules/amazon_pa/amazon_pa_filter/src/Plugin/Filter/AmazonFilter.php).
    
    Drupal\amazon_pa_filter\Plugin\Filter\AmazonFilter->process() (Line: 118)
    Drupal\filter\Element\ProcessedText::preRenderText()
    call_user_func_array() (Line: 101)
    Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 788)
    Drupal\Core\Render\Renderer->doCallback() (Line: 374)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 87)
    __TwigTemplate_e5b9730da48bbc843781931639e6d952b46abbb193029fcf7a812ad65c0f11ab->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 446)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 479)
    Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 220)
    __TwigTemplate_940aa5ec85d8795e85d016f15a60bea6937dce618d7f236992e93a3ff722fa6d->doDisplay() (Line: 405)
    Twig\Template->displayWithErrorHandling() (Line: 378)
    Twig\Template->display() (Line: 390)
    Twig\Template->render() (Line: 55)
    twig_render_template() (Line: 384)
    Drupal\Core\Theme\ThemeManager->render() (Line: 433)
    Drupal\Core\Render\Renderer->doRender() (Line: 204)
    Drupal\Core\Render\Renderer->render() (Line: 242)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 580)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 243)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 132)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
    call_user_func() (Line: 142)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 174)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 718)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    
  • 🇩🇪Germany marcoka

    Tried both tokens
    [amazon:3725207224:inline]
    [amazon:3725207224:details]

    Works here.

    I also tried to push my version to a beta 13 but suddenly git wants a password and is not using my public key no more. Puh... need to fix that first don´t know why that happens.

  • 🇩🇪Germany marcoka

    Ok i updated the code, had to use https because my keys are not accepted anymore even if the test command "ssh -T git@git.drupal.org" says all fine...no idea.

    The latest dev and also beta13 is the code i currently use on my live site like https://www.kopfhoerer-berater.de
    So it should work if you also use the library i attached.

    Thank you for any feedback.

  • 🇨🇭Switzerland Castor-designs

    Thank you very much for all your work! For me the second latest Beta version manually installed works with the librarie shared by you in this thread. We can close this issue.

  • 🇺🇸United States bobburns

    So is the php 8.1 issue now fixed ?? I cannot tell from the posts

  • 🇩🇪Germany marcoka

    The 8.1 issue is not the module itself, it was/is the sdk. It is possible that amazon updated it by now.
    Otherwise you can use my version uploaded here:
    https://www.drupal.org/files/issues/2023-03-24/amazon_sdk_mka.zip

    It really is a pain to use external sdks or libs you have no control over.
    I should do an own repo for the sdk but i haven´t had the time yet and that also adds more administartion work.

  • 🇩🇪Germany marcoka

    This should be fixed with the latest beta16 and the use of a new SDK repository.
    https://github.com/thewirecutter/paapi5-php-sdk
    Please help testing.

Production build 0.71.5 2024