AJAX Error When Adding Widget Plugin

Created on 2 December 2023, 7 months ago
Updated 15 March 2024, 4 months ago

Hello and thanks for this module,

Problem/Motivation

When I try to add Pixabay as the widget plugin for my entity browser, I get the error message below:

Oops, something went wrong. Check your browser's developer console for more details.

And when I check console with "Ctrl-Shift-i", I get the details as:

Object { message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /en/admin/config/content/entity_browser/pixabay/widgets?ajax_form=1\nStatusText: OK\nResponseText: ", name: "AjaxError", stack: "@http://drupal.localhost/core/misc/ajax.js?v=10.1.6:196:32\n@http://gp.docker.localhost/core/misc/ajax.js?v=10.1.6:1889:3\n" }

I've also increased max_execution_time and max_input_time in php.ini file, but the problem still exists.

Steps to reproduce

  • Install Drupal core 10.1.6
  • Install Media Pixabay 3.0.0 with dependencies
  • Create a new entity browser, called Pixabay
  • Try to "add widget plugin" as Pixabay
  • Get the error message

How can I solve it?

Best,
Orkut

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇹🇷Turkey Orkut Murat Yılmaz

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

Merge Requests

Comments & Activities

  • Issue created by @Orkut Murat Yılmaz
  • 🇹🇷Turkey Orkut Murat Yılmaz

    I've checked it after updating to Drupal 10.2.0 and the error is still there:

    Uncaught 
    Object { message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /en/admin/config/content/entity_browser/pixabay/widgets?ajax_form=1\nStatusText: parsererror\nResponseText: ", name: "AjaxError", stack: "@https://drupal.localhost/core/misc/ajax.js?v=10.2.0:196:32\n@https://drupal.localhost/core/misc/ajax.js?v=10.2.0:1915:3\n" }
    ​
    message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /en/admin/config/content/entity_browser/pixabay/widgets?ajax_form=1\nStatusText: parsererror\nResponseText: "
    ​
    name: "AjaxError"
    ​
    stack: "@https://drupal.localhost/core/misc/ajax.js?v=10.2.0:196:32\n@https://drupal.localhost/core/misc/ajax.js?v=10.2.0:1915:3\n"
    ​
    <prototype>: Error: 
    ​​
    columnNumber: 32
    ​​
    constructor: function AjaxError(xmlhttp, uri, customMessage)
    ​​
    fileName: "https://drupal.localhost/core/misc/ajax.js?v=10.2.0"
    ​​
    lineNumber: 196
    ​​
    stack: "@https://drupal.localhost/core/misc/ajax.js?v=10.2.0:196:32\n@https://drupal.localhost/core/misc/ajax.js?v=10.2.0:1915:3\n"
    ​​
    <prototype>: Error.prototype { stack: "", … }
  • 🇸🇮Slovenia bkomel

    Hi! I was not able to reproduce the error in the console, by following your steps on either Drupal core versions 10.1.6 or 10.2.0. Do you have any debug turned on perhaps? Can you please paste any related report log errors (The Database logging module has to be enabled)?

  • 🇹🇷Turkey Orkut Murat Yılmaz

    @bkomel, sorry for not providing details about the error message.

    I've just tried it on a local DDEV environment and I've faced the same error on the browser console. Then, I've typed "ddev logs" on my terminal. The last two lines of the output is:

    2024/01/08 21:08:00 [warn] 2150#2150: *449 an upstream response is buffered to a temporary file /var/cache/nginx/fastcgi_temp/1/00/0000000001 while reading upstream, client: 192.168.64.5, server: , request: "GET /sites/default/files/js/js_8iTNnVNQuE2Vb3THC5OgFDYqXNxyPxvWgoqP1A9F6WQ.js?scope=footer&delta=0&language=en&theme=gin&include=eJx9kVmShCAMhi-EcoY5iRUxaqaROAGssU_fccEpq6vngSX5vywEx32PaDvJM_ja7ZZxHBL-pgz-TyieylN4REUEbWCZwNNTIzwI28Fzq0RMq0KDGShYXQd7JgKXaME9SdEbcA5DusyRhZ5aD3yTmH0LckkU6OBiIvdYb5kdew9zxMNJ2q8EdX__ZJS17rXVGz6BGylgFWBCE7VmcjkVsdjmbMCWRnJEKdB2r0knE02HC-qstr0qaOK8xWX5f5wFh27SB57WfsZSdS9yBy4pif7XZ6keeUHZhhHeHlNjdDDj1xZsWhqamWa05fICd8fQjw HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "drupalstarter.ddev.site", referrer: "https://drupalstarter.ddev.site/admin/config/content/entity_browser/add"
    2024/01/08 21:08:24 [info] 2163#2163: *464 client closed connection while waiting for request, client: 192.168.64.5, server: 0.0.0.0:80
    [08-Jan-2024 21:08:29] WARNING: [pool www] child 3545 said into stderr: "NOTICE: PHP message: Uncaught PHP Exception TypeError: "Drupal\media_pixabay\Plugin\EntityBrowser\Widget\Pixabay::__construct(): Argument #10 ($logger) must be of type Drupal\Core\Logger\LoggerChannelFactory, Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /var/www/html/web/modules/contrib/media_pixabay/src/Plugin/EntityBrowser/Widget/Pixabay.php on line 197" at /var/www/html/web/modules/contrib/media_pixabay/src/Plugin/EntityBrowser/Widget/Pixabay.php line 147"
    2024/01/08 21:08:29 [error] 2161#2161: *466 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception TypeError: "Drupal\media_pixabay\Plugin\EntityBrowser\Widget\Pixabay::__construct(): Argument #10 ($logger) must be of type Drupal\Core\Logger\LoggerChannelFactory, Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /var/www/html/web/modules/contrib/media_pixabay/src/Plugin/EntityBrowser/Widget/Pixabay.php on line 197" at /var/www/html/web/modules/contrib/media_pixabay/src/Plugin/EntityBrowser/Widget/Pixabay.php line 147" while reading response header from upstream, client: 192.168.64.5, server: , request: "POST /admin/config/content/entity_browser/pixabay/widgets?ajax_form=1&_wrapper_format=drupal_ajax HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "drupalstarter.ddev.site", referrer: "https://drupalstarter.ddev.site/admin/config/content/entity_browser/pixabay/widgets"
  • 🇸🇮Slovenia bkomel

    Hi! Thank you for the details. You have the drupal/redirect module's submodule redirect_404 installed and enabled which decorates the logger.factory Drupal core service with the Redirect404LogSuppressor which implements the LoggerChannelFactoryInterface. The provided patch makes the Pixabay widget plugin accept all LoggerChannelFactoryInterface implementations for the $loggerFactory property.

  • Status changed to Needs review 6 months ago
  • Status changed to RTBC 6 months ago
  • 🇹🇷Turkey Orkut Murat Yılmaz

    @bkomel, thanks for your patch. it works nice:)

    can you create a merge request too?

  • 🇹🇷Turkey Orkut Murat Yılmaz

    @bkomel, thanks for the MR too:)

  • 🇸🇮Slovenia bkomel

    @Orkut Murat Yilmaz, you are welcome :)

  • First commit to issue fork.
  • Status changed to Fixed 4 months ago
  • 🇸🇮Slovenia slogar32

    Thank you both for your contributions!

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

Production build 0.69.0 2024