Running drush cache rebuild gives an error with Drupal core before 8.7.7.

drush cr

In InfoParserDynamic.php line 29:

Missing required keys (core) in modules/contrib/stage_file_proxy/stage_file_proxy.info.yml

Breaks config import as well.

Solution: upgrade your core or downgrade stage_file_proxy.

* use stage_file_proxy 8.x-1.0-beta1 for core < 8.7
* use stage_file_proxy 8.x-1.0-rc1 for core > 8.7.0 < 8.7.7
* use stage_file_proxy 8.x-1.0-rc2 for core >= 8.7.7

If drush won't enable stage_file_proxy saying "stage_file_proxy is incompatible with the Drupal version." then see this drush bug.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arsn created an issue. See original summary.

greggles’s picture

What version of core are you using?

greggles’s picture

Title: Missing required keys (core) in 8.x-1.0-rc2 » Missing required keys (core) in 8.x-1.0-rc2 when using core 8.6 or below
Status: Active » Postponed (maintainer needs more info)

From the release notes "Prevents some conflicts with outdated versions of core. If you need to use this module on an 8.6 site please use the 8.x-1.0-beta1 release."

davidburns’s picture

I'm also getting this error w/ Drupal core 8.7.7

Spokje’s picture

Seen it too on Core 8.7.8, then did a composer require 'drupal/stage_file_proxy:1.0.0-rc1 explicitly to get a working version.

Somehow after that composer require 'drupal/stage_file_proxy:^1.0' upgraded me to 1.0.0-rc2 without the error.

Thought I had made a mistake/typo/upset-the-composer-gods-somehow and thought nothing more of it.
Our agency has around around 25 other sites waiting for me to do this update, will see if it re-occurs.

greggles’s picture

Title: Missing required keys (core) in 8.x-1.0-rc2 when using core 8.6 or below » Missing required keys (core) in 8.x-1.0-rc2
Version: 8.x-1.x-dev » 8.x-1.0-rc2

@davidburns and @Spokje - thanks for your insights. You're getting this with 8.x-1.0-rc1 or 8.x-1.0-rc2 release of this module?

greggles’s picture

Here's the steps I followed to start with a fresh site and rc1 on Drupal 8.7.9-dev, clear cache, move to rc2, clear cache and I didn't observe the problem. I wonder if it happens with core 8.7.7? If you upgrade core does the problem go away?

gknaddison@drupal-web:/var/www/html$ composer require 'drupal/stage_file_proxy:1.0.0-rc1'
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing drupal/stage_file_proxy (1.0.0-rc1): Downloading (100%)
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
gknaddison@drupal-web:/var/www/html$ drush si
You are about to DROP all tables in your 'db' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option. [ok]
Installation complete. User name: admin User password: WoDKsswuaP [ok]
Congratulations, you installed Drupal! [status]
gknaddison@drupal-web:/var/www/html$ drush pm:enable stage_file_proxy
The following extensions will be enabled: stage_file_proxy
Do you really want to continue? (y/n): y
stage_file_proxy was enabled successfully. [ok]
stage_file_proxy defines the following permissions: administer stage_file_proxy settings
gknaddison@drupal-web:/var/www/html$ drush cr
Cache rebuild complete. [ok]
gknaddison@drupal-web:/var/www/html$ composer require 'drupal/stage_file_proxy:1.0.0-rc2'
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating drupal/stage_file_proxy (1.0.0-rc1 => 1.0.0-rc2): Downloading (100%)
> Drupal\Core\Composer\Composer::vendorTestCodeCleanup
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess
gknaddison@drupal-web:/var/www/html$ drush cr
Cache rebuild complete. [ok]
gknaddison@drupal-web:/var/www/html$ drush status
Drupal version : 8.7.9-dev
Site URI : https://drupal.ddev.site
Database driver : mysql
Database hostname : db
Database port : 3306
Database username : db
Database name : db
Database : Connected
Drupal bootstrap : Successful
Drupal user :
Default theme : bartik
Administration theme : seven
PHP configuration : /etc/php/7.2/cli/php.ini
PHP OS : Linux
Drush script : /usr/local/bin/drush8
Drush version : 8.2.3
Drush temp directory : /tmp
Drush configuration : /var/www/html/sites/default/drushrc.php
Drush alias files :
Install profile : standard
Drupal root : /var/www/html
Drupal Settings File : sites/default/settings.php
Site path : sites/default
File directory path : sites/default/files
Temporary file directory path : /tmp
Sync config path : sites/default/files/sync

gknaddison@drupal-web:/var/www/html$

jespermb’s picture

We have just experienced the same issue. We are using Drupal core 8.7.5 and after upgrading to RC2 we got this error. We upgraded from beta1.

greggles’s picture

Unfortunately, upgrading the code to be compatible with Drupal 9 means it's incompatible with Drupal <8.7.7. So the info file has been made incompatible with <8.7.7 to give an early notice of the problem.

I will try today to repeat my test steps with 8.7.5.

@jespermb I suggest upgrading to 8.7.7 if you can or downgrading stage file proxy to beta1.

Spokje’s picture

@greggles FWIW: I've looked it up and I was at fault.

I did an update for stage_file_proxy beta1 => rc2 but the site was on D8.7.6, so there's why it gave the error message.

> Unfortunately, upgrading the code to be compatible with Drupal 9 means it's incompatible with Drupal <8.7.7

So you're absolutely on the money there ^

I've downgraded stage_file_proxy rc2 => rc1, that worked.
After that I've upgraded Core D8.7.6 => D8.7.8
Then I've upgraded stage_file_proxy rc1 => rc2 which then worked.

TLDR: I changed too much too fast.

> Unfortunately, upgrading the code to be compatible with Drupal 9 means it's incompatible with Drupal <8.7.7

Here's the root cause of _my_ problem, the module is fine, use rc1 when < 8.7.7, rc2 works flawlessly >= 8.7.7

greggles’s picture

Thanks for the clarification/insight @Spokje.

One more thought: the #3084611: prepareDirectory vs file_prepare_directory breaks with core <8.7 issue is about conflicts with rc1 and <8.7. So a slight amendment to your last line:

* use beta1 when < 8.7
* use rc1 when > 8.7.0 < 8.7.7
* use rc2 >= 8.7.7

For the other people reporting issues - does that guide help? If so I'll put this on the project page and release notes.

jennypanighetti’s picture

I just tried to enable 8.x-1.0-rc2 for my 8.7.7 site per your notes above, but it keeps telling me "stage_file_proxy is incompatible with the Drupal version."

greggles’s picture

Thanks for the feedback, @jennypanighetti. I followed these steps just now to try to debug this issue:

0. In a Drupal core git working copy, git checkout 8.7.7
1. composer require 'drupal/stage_file_proxy:1.0.0-rc2
2. drush site-install -y
3. drush user-login
4. as admin, visit admin/modules
5. Confirm stage_file_proxy is 8.x-1.0-rc2
6. Enable stage_file_proxy via admin/modules in the web ui
7. I did not observe any errors
8. Ran a drush cr
9. I did not observe any errors

Is there something more I should do?

I was able to get the issue to occur very quickly on 8.7.6:

❰gknaddison❙~/Sites/devdesktop/drupal❱✔≻ git checkout 8.7.6
Previous HEAD position was 8a665ec6b0 Drupal 8.7.7
HEAD is now at c0266717dc Drupal 8.7.6
❰gknaddison❙~/Sites/devdesktop/drupal❱✔≻ ddev ssh
gknaddison@drupal-web:/var/www/html$ drush si -y
You are about to DROP all tables in your 'db' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option.                                                                                                      [ok]
Drupal\Core\Extension\InfoParserException: Missing required keys (core) in modules/contrib/stage_file_proxy/stage_file_proxy.info.yml in                                                          [error]
/var/www/html/core/lib/Drupal/Core/Extension/InfoParserDynamic.php:29
... snip lots more errors...
larowlan’s picture

FWIW the issue here is with 8.7.6

The .info.yml says system >=8.7 but it needs to be >=8.7.7

Composer facade shows rc1 compatible with any version of 8.7

greggles’s picture

@larowlan, are you saying:

dependencies:
  - drupal:system (>=8.7)

Should be:

dependencies:
  - drupal:system (>=8.7.7)

And in composer.json

  "require": {
    "drupal/core": ">=8.7.0"
  }

should be:

  "require": {
    "drupal/core": ">=8.7.7"
  }
larowlan’s picture

I think so, but pretty sure the composer.json is based off the .info.yml via the project composer facade

smaz’s picture

I'm getting this issue too (Drupal 8.7.8, stage file proxy 8.x-1.0-rc2). I'm just digging into it some more, but as an initial note:

The module only fails to install when being enabled via drush en stage_file_proxy. The module installs fine via the UI, or when enabled during a config import (we use config_split to only enable it on local versions).

smaz’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Yep, I've looked into this some more & can confirm it is a drush issue. Drush is explicitly requiring the core: key, which is wrong as it is no longer a fixed requirement.

Also note the string 'stage_file_proxy is incompatible with the Drupal version' is generated by drush, and not core (drush_pm_enable_validate(), '!name is incompatible with the !component version.').

I've opened an issue with drush for this:
https://github.com/drush-ops/drush/issues/4219

For those experiencing the issue, try enabling the module via the UI rather than with drush. You might also be able to try using Drupal Console, I had it work with the following:

Drupal Console Launcher version 1.8.0
Drupal Console version 1.2.0

drupal moi stage_file_proxy
Installing module(s) "stage_file_proxy"
                                                                                                                        
[OK] The following module(s) were installed successfully: "stage_file_proxy"                                           
                                                                                                                    
// cache:rebuild

Rebuilding cache(s), wait a moment please.

[OK] Done clearing cache(s).

I'm going to mark this as 'works as designed'.

greggles’s picture

Title: Missing required keys (core) in 8.x-1.0-rc2 » Missing required keys (core) in 8.x-1.0-rc2 - also ensure consistent info and composer requirements
Issue summary: View changes
Status: Closed (works as designed) » Needs review
FileSize
619 bytes

x-posted with #18, agreed with it.

@smaz, I think that's a slightly different issue. I can also observe that on an 8.7.7 or 8.7.8 core when I enable via the web UI it installs fine, but enabling via drush gives the error "stage_file_proxy is incompatible with the Drupal version. [error]". That is apparently https://github.com/drush-ops/drush/issues/4219 as you've filed it over there :)

I think the issue that larowlan describes (the info and composer state compatability with >=8.7, although really only >=8.7.7 are supported) seem a bit different than the focus of the title of this issue, but it does seem worth fixing regardless.

I just asked in #contribute and per mglaman, mixologic, jhodgdon it seems that modules should generally provide their own composer.json files, though obviously they should be in sync with the info.yml. Attached patch attempts to make the files consistent with themselves and each other.

I also cleaned up the issue summary a bit to be a bit more helpful for folks who land on this issue.

smaz’s picture

Title: Missing required keys (core) in 8.x-1.0-rc2 - also ensure consistent info and composer requirements » Ensure consistent info and composer requirements
Status: Needs review » Reviewed & tested by the community

Ah, I got sidetracked as to drush being the issue because of everyone having the same error message.

Sorry for the title change again, but the core key isn't required & the patch is now just fixing up the info/composer requirements :)

Patch applies cleanly & looks good to me!

greggles’s picture

Title: Ensure consistent info and composer requirements » Missing required keys (core) in 8.x-1.0-rc2 - Also ensure consistent info and composer requirements

Thanks for the review, @Smaz. I'll keep this at RTBC for a bit for more review/feedback.

Also I'm adjusting the title. I'd like to keep that error message in the title since even after this issue is "fixed" people are going to be searching for that error and wondering what to do (which is now in the issue summary).

DamienMcKenna’s picture

For anyone who wants to add it to their site's composer.json file's patches list, this just adds the 'core' line.

  • greggles committed ae7de6f on 8.x-1.x
    Issue #3086276 by greggles, larowlan: Missing required keys (core) in 8....
greggles’s picture

@damienmckenna - can you clarify how that helps as opposed to just following one of these strategies:

* upgrade core to > 8.7.7 and use latest stage_file_proxy OR:
* use stage_file_proxy 8.x-1.0-beta1 for core < 8.7
* use stage_file_proxy 8.x-1.0-rc1 for core > 8.7.0 < 8.7.7
* use stage_file_proxy 8.x-1.0-rc2 for core >= 8.7.7

I've now committed this patch and updated the project page and the most recent releases.

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Forgot to update the status. I think this is as "fixed" as it can be. There are still situations where people need to take manual actions.

DamienMcKenna’s picture

It was meant as a stop-gap I needed while setting up a new project that also needed core updates, I wasn't intending it to be committed.

vuil’s picture

The issue still exists (Drupal core 8.2.6, stage_file_proxy: 8.x-1.0-rc2) before Drupal core update.

Please just add the required line core: 8.x
in your main .info file. (A similar as #22)
Thank you!

I post the error message after drush cr:

Drupal\Core\Extension\InfoParserException: Missing required keys (core) in modules/contrib/stage_file_proxy/stage_file_proxy.info.yml in /var/www/html/web/core/lib/Drupal/Core/Extension/InfoParserDynamic.php:29         [error]
Stack trace:
#0 /var/www/html/web/core/lib/Drupal/Core/Extension/InfoParser.php(22): Drupal\Core\Extension\InfoParserDynamic->parse('modules/contrib...')
#1 /var/www/html/web/core/modules/system/system.module(997): Drupal\Core\Extension\InfoParser->parse('modules/contrib...')
#2 /var/www/html/web/core/modules/system/system.module(1074): _system_rebuild_module_data()
#3 /var/www/html/web/core/includes/common.inc(1106): system_rebuild_module_data()
#4 /var/www/html/web/core/includes/utility.inc(51): drupal_flush_all_caches()
#5 phar:///usr/local/bin/drush/commands/core/cache.drush.inc(302): drupal_rebuild(Object(Composer\Autoload\ClassLoader), Object(Symfony\Component\HttpFoundation\Request))
#6 phar:///usr/local/bin/drush/includes/command.inc(422): drush_cache_rebuild()
#7 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#8 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command()
#9 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#10 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#11 phar:///usr/local/bin/drush/includes/startup.inc(465): drush_main()
#12 phar:///usr/local/bin/drush/includes/startup.inc(369): drush_run_main(false, '/', 'Phar detected. ...')
#13 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#14 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#15 {main}

Please see more here:
https://www.drupal.org/docs/8/creating-custom-modules/let-drupal-8-know-...

smaz’s picture

If anyone is still having this issue, you'll need to use the patch from #22 until there is a new release of the module (rc3 I'm guessing). If you're using composer, take a look at https://github.com/cweagans/composer-patches for applying patches,

vuil’s picture

#22 patch is wrong and it couldn't help.
The .info.yml file needs core: 8.x instead of core: 8 only.

I create a new one which works. Thank you!

DamienMcKenna’s picture

Status: Needs review » Fixed

Thanks Vuil.

Of course, if you're still using Drupal core 8.2.6 you have other problems.

greggles’s picture

Hi,

The info file is now right :) Please don't suggest changing it. Here are the solutions:

* upgrade core to > 8.7.7 and use latest stage_file_proxy OR:
* use stage_file_proxy 8.x-1.0-beta1 for core < 8.7
* use stage_file_proxy 8.x-1.0-rc1 for core > 8.7.0 < 8.7.7
* use stage_file_proxy 8.x-1.0-rc2 for core >= 8.7.7

Status: Fixed » Closed (fixed)

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