drush updb fails

Created on 28 December 2023, 11 months ago
Updated 7 April 2024, 8 months ago

Problem/Motivation

With latest slick and blazy modules, cannot drush updb without error of "Output is Empty."

> PHP Fatal error:  Declaration of Drupal\slick\SlickManagerInterface::build(array $build = Array) must be compatible with Drupal\blazy\BlazyManagerInterface::build(array $build): array in /var/www/sanangelolive.com/stage/docroot/modules/contrib/slick/src/SlickManagerInterface.php on line 43
> PHP Fatal error:  Uncaught TYPO3\PharStreamWrapper\Exception: Unexpected file extension in "phar:///home/sanang6/.config/composer/vendor/bin/drush/.box/bin/core/modules/mysql/src/Driver/Database/mysql//Insert.php" in /var/www/sanangelolive.com/stage/docroot/core/lib/Drupal/Core/Security/PharExtensionInterceptor.php:44
> Stack trace:
> #0 /var/www/sanangelolive.com/stage/vendor/typo3/phar-stream-wrapper/src/Behavior.php(72): Drupal\Core\Security\PharExtensionInterceptor->assert()
> #1 /var/www/sanangelolive.com/stage/vendor/typo3/phar-stream-wrapper/src/Manager.php(110): TYPO3\PharStreamWrapper\Behavior->assert()
> #2 /var/www/sanangelolive.com/stage/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php(421): TYPO3\PharStreamWrapper\Manager->assert()
> #3 /var/www/sanangelolive.com/stage/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php(410): TYPO3\PharStreamWrapper\PharStreamWrapper->assert()
> #4 phar:///home/sanang6/.config/composer/vendor/bin/drush/.box/vendor/composer/ClassLoader.php(571): TYPO3\PharStreamWrapper\PharStr in /var/www/sanangelolive.com/stage/docroot/core/lib/Drupal/Core/Security/PharExtensionInterceptor.php on line 44

And...

In ProcessBase.php line 155:
                    
  Output is empty.  
                    

On Ubuntu and php 7.4.28

Steps to reproduce

composer require drupal/blazy
composer require drupal/slick

blazy on 8.x-2.22
slick on 8.x-2.3
(as of Dec 28, 2023)

drush cr works fine beginning and after attempting drush updb
When running the updb command, the process terminates with fatal error concerning

PHP Fatal error:  Declaration of Drupal\slick\SlickManagerInterface::build(array $build = Array) must be compatible with Drupal\blazy\BlazyManagerInterface::build(array $build): array in /var/www/sanangelolive.com/stage/docroot/modules/contrib/slick/src/SlickManagerInterface.php on line 43

Proposed resolution

Better instructions about installing these two modules together or fix the code.

Remaining tasks

User interface changes

API changes

Data model changes

(edited to correct the composer commands)

💬 Support request
Status

Closed: duplicate

Version

2.0

Component

Documentation

Created by

🇺🇸United States jghyde

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

Comments & Activities

  • Issue created by @jghyde
  • Status changed to Postponed 11 months ago
  • 🇮🇩Indonesia gausarts

    Thank you.

    You are correct.

    All you need to do is update both modules to the latest.

    Slick:2.3 is way too old against the current Slick:2.10 and Blazy:2.22 as per this writing. Note the date releases. And this date release match has been warned about ever since version 1.x at both module docs.

    > Composer
    The easiest and recommended way of running composer:
    composer require drupal/slick:^2.0 drupal/blazy:^2.0

    Note the keywords:
    "require", "^" and ".0".

    Not by touching composer.json file like you did.

    Then things will fall in place.
    If out of sync, Composer will prevent the update.

    That is the point of using Composer. You would save headaches from dependencies management.

    What happened now is you are acting as Composer, not using it, and will likely result in error.

    Unless a special lock is required like blazy:2.6 dev storms, normally you are informed:
    https://www.drupal.org/node/2663268/revisions/12659274/view#blazy-sop

    > Documentations
    This may apply to the entire contribs:
    README.md or /admin/help is normally outdated.
    The most updated info will be project home descriptions.

    Re-visiting project home is a must if any issues with updates.

    At any regularly developed modules with hard/soft dependencies, outdated versions will likely be out of sync, if not error. See outdated ImageEffects:3.4 before 3.5 out vs. ImageMagick:3.6, etc.

    We are improving:
    https://git.drupalcode.org/project/blazy/-/blob/8.x-2.17/docs/README.md?...

    I am a very polite person, I wouldn't dare to say RTFM, but normally some other polite people do.

    And improvements are always welcome.
    Feel free to contribute in projects named contribs.

    Note:
    Intentionally postponed since this doc dup had dups so many times.

  • 🇺🇸United States jghyde
  • 🇺🇸United States jghyde

    Slick with Blazy are required in composer files of other projects, for example the Thunder distribution. Upgrading within the confines of these other projects that require slick and blazy can create mini "dev storms" due to mismatching of the blazy version and the slick version. Generally, as of Dec. 28, 2023, this procedure will work for installing or upgrading slick and blazy together, as required.

    1. Use composer as a tool, don't use it to compose by editing the composer.json file. Run these 2 commands:

    composer require drupal/slick:^2.0 
    composer require drupal/blazy:^2.0
    

    This should match the two projects' versions to each other.

    2. Clear the cache, maybe several times. drush cr

    3. Run drush updb

    4. Run drush cr

    5. Repeat as necessary (such as if the drush updb errors out.

    6. You can discover what other installed projects or distributions are requiring slick and blazy — along with the version numbers of the requirements — by using the command composer why drupal/slick or composer why drupal/blazy. There may be a reason to open a report in the other project's issue queue should the other project's composer requirements are not allowing a smooth transition to the upgraded paired and compatible versions of Slick and Blazy.

    (The above might deserve a place on the home page or somewhere else prominant in that it specifically addresses composer installations. BTW, pointing me to use the ^2.0 versions for each composer require fixed my problem. IDK why because both slick and blazy are on the same versios as before... Or maybe it fixed itself. Thanks!)

  • 🇺🇸United States jghyde

    #4 went well for the dev server. This next day we tried deploying to the stage server. Unfortunately, the same error happened.

    Drush updb and any page load returns:

    PHP Fatal error:  Declaration of Drupal\slick\SlickManagerInterface::build(array $build = Array) must be compatible with Drupal\blazy\BlazyManagerInterface::build(array $build): array in /var/www/html/docroot/modules/contrib/slick/src/SlickManagerInterface.php on line 43
    
  • 🇮🇩Indonesia gausarts

    Your error is all about cache.

    At the bottom of Blazy project home, there is Update SOP.

    Have you tried following the procedures strictly?

    If no, please do so, and report back.
    If yes, and still errors, try a total rebuild:
    1. rename/remove vendor folder and composer.lock
    2. Run composer:

    composer require .... --no-update
    composer update -W -n

    3. Clear cache and update:

    drush cr
    drush updb
    drush cr
    

    The composer require ... part is optional/ not needed here if you already did composer correctly where ... is drupal/slick:^2.0 etc. that you want to use correct syntax as mentioned above. Correctly here simply means using constraints like caret ^ or even tilde ~ before versions, not locking projects to particular versions without constraints. Unless really required, and you know what it means by locking versions, of course.

    The above commands should clear things up. Just be sure you have good internet connection.

    The total rebuild is hardly needed if you follow blazy Update SOP strictly.
    It is only needed for errors you cannot solve with regular Update SOP.

    Be sure to test the commands out in this comment at your DEV environment first!

  • 🇺🇸United States jghyde

    I am out of the woods on this one now. Thanks for the help!

    Another technique I used, as I had this problem for every deployment on local, dev, stage, and prod, is to manually download *.zip files of older versions of slick and blazy to your modules dir to temporarily use them to get blazy and slick into sync. In the end, once you have the latest of both, which work together, delete the downloaded directories, cd modules/contrib and then rm -rf both blazy and slick. Then run a composer install so that composer had installed the blazy and slick modules, preventing this from happening to other devs on your team. Then drush cr; drush updb; drush cr.

    This happens when you take over a drupal install that hasn't been updated since D8.9!

  • Status changed to Closed: duplicate 8 months ago
  • 🇮🇩Indonesia gausarts

    3.x is out.

    Any contribution should refer to the provided docs as outlined at project home:
    https://git.drupalcode.org/project/slick/-/blob/3.0.x/docs/CONTRIBUTION....

Production build 0.71.5 2024