Configuration errors with Cloudinary after upgrading to Drupal 9.4.5

Created on 13 September 2022, about 2 years ago
Updated 7 April 2023, over 1 year ago

Problem/Motivation

I upgraded my Drupal core instance to Drupal 9.4.5 and am using the latest Cloudinary module version 2.1.0-alpha. Since the upgrade we have been having a lot of Cloudinary errors show up in our logs. It says that Cloudinary is not configured correctly but I have all of the information added into the configuration settings in the Drupal module and my site IS connecting to Cloudinary. Error is below:

[12-Sep-2022 15:46:18 America/New_York] Uncaught PHP Exception Cloudinary\Exception\ConfigurationException: "Invalid configuration, please set up your environment" at /var/www/html/vendor/cloudinary/cloudinary_php/src/Configuration/Configuration.php line 293 request_id="v-90a50052-32d3-11ed-b793-9fbc8472a59c"

Any ideas why we are getting this error? Drupal Support at Acquia says I should ask someone at Cloudinary and Cloudinary support says to talk to the third party developers here.

🐛 Bug report
Status

Needs review

Version

2.1

Component

Code

Created by

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States Digital Fire

    Hi @nginex,

    We are running v2.1.3 of the module are reporting the same issue. We are on Drupal 9.5.7 & PHP 8.1.12.

  • 🇺🇦Ukraine nginex

    I see some outdated code in CloudinaryStreamWrapper::__constructor()

    I've provided a patch, let me know if it works for you

  • 🇺🇸United States Digital Fire

    I applied the patch and cleared all cache. Unfortunately, we are still seeing the issue.

    Was there anything else I needed to do besides those steps?

  • 🇺🇦Ukraine nginex

    I think I do not have enough information to reproduce the bug, could you please let me know where and when exactly do you get the error? any steps to reproduce?

  • 🇺🇸United States Digital Fire

    When viewing "/admin/content/files" it has a hard error and the page is unusable.

    When trying to create/use a content type with an image field, it has an soft error in the background that shows up in the logs.

    For example; We have a basic article content type with an image field. When clicking the button that should present the media library. The ajax spinner shows up like its attempting to show but it never pops up. This is the route shown in the logs; "node/add/article?_wrapper_format=drupal_ajax&ajax_form=1"

  • 🇺🇦Ukraine nginex

    did you fill in API credentials here /admin/config/media/cloudinary?

    I cound only reproduce the issue when I created a cloudinary image, uninstall cloudinary module, enable the module again without providing api credentials. Once I entered api credentials and saved the form the error gone

  • 🇺🇸United States Digital Fire

    Yes, the credentials are in place and can also be seen when checking from the cli.

  • 🇧🇯Benin delacosta456

    hi
    i was planning to use the module but unfortunately i am also having this issue withe php8.1.18 and Drupal 9.5.9
    None of the patch worked for me

    Any help to solve this would be welcome

    Thanks

  • Status changed to Needs work 12 months ago
  • 🇺🇦Ukraine nginex

    it appears that there are places where cloudinary api is used but cloudinary_sdk_init() is not triggered.

    e.g. drush command

    Need to refactor the way how and when cloudinary_sdk_init() is triggered.

  • 🇮🇳India kmani

    Any update on the above issue? after upgrading drupal 9.5 to Drupal 10.2.2

    When viewing "/admin/content/files" it has a hard error and the page is unusable.

    The website encountered an unexpected error. Try again later.

    InvalidArgumentException: A path was passed when a fully qualified domain was expected. in Drupal\Component\Utility\UrlHelper::externalIsLocal() (line 305 of core/lib/Drupal/Component/Utility/UrlHelper.php).
    Drupal\Core\File\FileUrlGenerator->generate('cloudinary://xxxx/images/2023/09/26/test_1695696987.jpeg') (Line: 99)
    Drupal\file\Plugin\Field\FieldFormatter\BaseFieldFileFormatterBase->viewElements(Object, 'en') (Line: 89)
    Drupal\Core\Field\FormatterBase->view(Object, 'en') (Line: 268)
    Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 269)
    Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple(Array) (Line: 226)
    Drupal\Core\Entity\Entity\EntityViewDisplay->build(Object) (Line: 460)
    Drupal\Core\Entity\EntityViewBuilder->viewField(Object, Array) (Line: 243)

  • Assigned to klaasvw
  • Status changed to Needs review 29 days ago
  • 🇧🇪Belgium klaasvw

    The real problem is indeed that cloudinary_sdk_init() is not executed if a module like dynamic_page_cache is enabled, or drush is used.

    There are two reasons for that:

    • dynamic_page_cache has priority 27 when subscribing to KernelEvents::REQUEST, which is higher than cloudindary
    • drush doesn't use the KernelEvents::REQUEST event

    I'm going create an MR for 3.0.x that fixes these issues.

Production build 0.71.5 2024