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

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Orkut Murat Yılmaz created an issue. See original summary.

orkut murat yılmaz’s picture

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: "", … }
bkomel’s picture

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)?

orkut murat yılmaz’s picture

@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"
bkomel’s picture

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

bkomel’s picture

Status: Active » Needs review
orkut murat yılmaz’s picture

Status: Needs review » Reviewed & tested by the community

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

can you create a merge request too?

orkut murat yılmaz’s picture

@bkomel, thanks for the MR too:)

bkomel’s picture

@Orkut Murat Yilmaz, you are welcome :)

slogar32 made their first commit to this issue’s fork.

  • slogar32 committed dd4d0d77 on 3.0.x authored by bkomel
    Issue #3405721 by bkomel, slogar32, Orkut Murat Yılmaz: AJAX Error When...
slogar32’s picture

Status: Reviewed & tested by the community » Fixed

Thank you both for your contributions!

slogar32’s picture

Status: Fixed » Closed (fixed)

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