Original composer managed D8.6.15 site with [drush updb] and [drush entup] showing no updates required. Using PHP 7.2.17.
Updated core to D8.7.0 using composer with no errors.
However running [drush updb] afterwards results in WSOD and the following error:
------------------- ---------------- --------------- -------------------------
Module Update ID Type Description
------------------- ---------------- --------------- -------------------------
file 8700 hook_update_n Set the 'owner' entity
key and update the
field.
menu_link_content make_menu_link post-update Update custom menu
_content_revis links to be
ionable revisionable.
system add_expand_all post-update Initialize
_items_key_in_ 'expand_all_items'
system_menu_bl values to
ock system_menu_block.
system clear_menu_cac post-update Clear the menu cache.
he @see
https:www.drupal.orgpro
jectdrupalissues3044364
taxonomy make_taxonomy_ post-update Update taxonomy terms
term_revisiona to be revisionable.
ble
taxonomy remove_hierarc post-update Remove the 'hierarchy'
hy_from_vocabu property from
laries vocabularies.
views exposed_filter post-update Update exposed filter
_blocks_label_ blocks label display to
display be disabled.
views make_placehold post-update Rebuild cache to allow
ers_translatab placeholder texts to be
le translatable.
------------------- ---------------- --------------- -------------------------
Do you wish to run the specified pending updates? (yes/no) [yes]:
>
> [notice] Update started: file_update_8700
> [error] Field storage definition for 'type' could not be found.
> [error] Update failed: file_update_8700
> TypeError: Argument 3 passed to Drupal\views\EntityViewsData::mapFieldDefinition() must implement interface Drupal\Core\Field\FieldDefinitionInterface, null given, called in /var/www/html/drupal/web/core/modules/views/src/EntityViewsData.php on line 290 in /var/www/html/drupal/web/core/modules/views/src/EntityViewsData.php on line 387
Full message attached.
Where do I begin?
Comments
Comment #2
waverate commentedComment #3
waverate commentedComment #4
cilefen commentedIt looks like views to me.
Comment #5
xjmComment #6
xjmComment #7
swentel commentedHmm, file has no type field in core right ? This might come from the file_entity module maybe ?
Comment #8
waverate commentedComment #9
larowlanCan you post the output of
drush php-eval "var_export(array_keys(\Drupal::service('entity.last_installed_schema.repository')->getLastInstalledFieldStorageDefinitions('file')));"I suspect your last installed entity definitions might reference the type field which was added at some point by file_entity
Comment #10
waverate commentedComment #11
waverate commentedIn case it helps, I am running Healthcheck and Site Audit modules with no errors detected.
Comment #12
larowlanThanks, how about this one
drush php-eval "var_export(array_keys(\Drupal::service('entity.last_installed_schema.repository')->getLastInstalledDefinition('file')->getKeys()));"We should not see a 'bundle' key
Comment #13
waverate commentedComment #14
larowlanThat's it!
Here's the annotation:
You'll note - no bundle.
So you'll need to unset that bundle.
Something like so
Comment #15
waverate commentedAfter recommendation at #14:
Am I ready to try to upgrade?
Comment #16
larowlanAssuming you have a backup, I think so
Comment #17
waverate commentedThat worked. Thank you @larowlan.
1. How do you want to proceed? Priority? Status?
2. How do you want to capture this by test and/or solution?
Comment #18
larowlanThis was purely a per-site thing, a carry-over from file entity being enabled at some stage would be my guess.
Thanks for your time and for reporting it, hopefully it helps someone else having this record here.
Adding issue credits for those who helped out.
Comment #19
vuilThe same issue...
@waverate, @larowlan - Where to put this #14 code? A custom module or a hook?
Comment #20
waverate commented@i.vuchkov. I was lazy. I installed https://www.drupal.org/project/devel_php and ran it from /devel/php
Comment #21
waverate commentedAlso in my case, I didn’t have file_entity installed currently. As larowlan pointed out in #9, it was probably loaded at some point but it did not uninstall correctly. If you still have file_entity installed, it looks like #3051827: Compatibility with Drupal 8.7 may be the solution.
Comment #22
vuil@waverate Yes, my issue is similar, but somewhere in menu_link_content.post_update with the following error:
Comment #23
waverate commentedThat looks like #3039586: Cannot rename tmp_2362aemenu_link_content_revision to menu_link_content_revision.
Comment #24
vuilComment #25
xjmNote that the title of #3039586: Cannot rename tmp_2362aemenu_link_content_revision to menu_link_content_revision and reports of it might be a red herring: This will happen any time you already ran the DB update and that one completed successfully but something else broke the process. So it might not be the real bug.
In any case let's keep this issue about specifically
file_update_8700()and file new ones if we find different underlying problems.Comment #26
pameeela commented@waverate @i.vuchkov: Thanks for taking part in this issue. If you'd like to help us make sure the 8.8.0 update is as smooth as possible, please consider signing up for the beta testing program at https://goo.gl/forms/bMBTMRSY3sKEscUJ3
Comment #27
vensiresSince the problem came from the file_entity module shouldn't this issue get back to active and be assigned to the file_entity module?
Comment #28
mister vandenweb commentedI have the same problem but I have nowhere to execute code in #14 since the site is completely broken. How else can I execute the code ?
Isn't there a way to do that from drush ?
Comment #29
dougiep commentedAlso encountering this error, I detected and successfully removed bundle, however it did not help. Any other ideas to try?
TypeError: Argument 3 passed to Drupal\views\EntityViewsData::mapFieldDefinition() must implement interface Drupal\Core\Field\FieldDefinitionInterface, null given, called in /home/halberdb/public_html/core/modules/views/src/EntityViewsData.php on line 290 in Drupal\views\EntityViewsData->mapFieldDefinition() (line 387 of core/modules/views/src/EntityViewsData.php).
Comment #30
TheEcape94 commentedI have the same issue as one described in #29. I am trying to upgrade core from 8.6.16. to 8.7.2.
Does someone have a solution?
Comment #31
waverate commented@Mister VandenWeb, @dougip and @TheEcape94. Are you able to restore the database from backup, run the drush commands and then post the results from #9 and #12?
Comment #32
dougiep commentedHi Waverate,
#9:
array (
0 => 'fid',
1 => 'uuid',
2 => 'langcode',
3 => 'uid',
4 => 'filename',
5 => 'uri',
6 => 'filemime',
7 => 'filesize',
8 => 'status',
9 => 'created',
10 => 'changed',
)
#12:
array (
0 => 'id',
1 => 'label',
2 => 'langcode',
3 => 'uuid',
4 => 'revision',
5 => 'bundle',
6 => 'default_langcode',
)
Previously I had removed bundle per your instruction but still encountered the same error. Any thoughts on a new strategy?
Comment #33
waverate commented@dougiep.
1. Was this a site migrated from D7?
2. Is/was the File Entity Module installed on the D8 site? D7 site?
Comment #34
dougiep commented@waverate,
Not migrated from D7, but it was an early 8.0.x release with composer added post-installation.
I don't think so. The site previously had Commerce 2.x installed but later removed, but I don't recall Commerce using File Entity as a dependency.
Comment #35
TheEcape94 commentedHi @Waverate @dougiep.
The same situation for me. Previously I had removed bundle per instructions from #9 and #12, but still, the same error occurs.
How I know it's a D8 project from the beginning. And File Entity Module isn't installed.
Any thoughts regarding this?
Comment #36
vuilComment #37
vuilComment #38
brooke_heaton commentedI'm having this same issue. How is this possibly 'Closed (fixed)'. I don't get it.
Comment #39
sershevchykI still have an error when trying to install the project from configs http://prntscr.com/o5wqyl
TypeError: Argument 3 passed to Drupal\views\EntityViewsData::mapFieldDefinition() must implement interface Drupal\Core\Field\FieldDefinitionInterface, null given, called in /var/www/fsc/fsc.org/web/core/modules/views/src/EntityViewsData.php on line 290 in Drupal\views\EntityViewsData->mapFieldDefinition() (line 387 of /var/www/fsc/fsc.org/web/core/modules/views/src/EntityViewsData.php).My configuration worked fine until I install module Deploy. But we need this module and need to fix this error. Does someone have an idea of what we can do with this error?
Comment #40
lukusI'm experiencing the same problem.
1. Was this a site migrated from D7? -> Some data was migrated via a CSV file.
2. Is/was the File Entity Module installed on the D8 site? D7 site? -> Error becomes apparent when file_entity module is uninstalled.
Comment #41
sershevchyk@lukus
1. No, it's a new project on D8
2. We haven't module File Entity on our project. I found only module Entity, but I think it's not a problem
Comment #42
lukusHey @shefarik
Running the code snippet in #14 in a hook update seems to solve the problem for me.
e.g.
and then run `drush updatedb`
Make sure you backup prior to running.
Comment #43
bengt commentedHi @Waverate and others,
I still have issues with this kind of error. I try to update from 8.6.16 -> 8.7.5. It is originally a Drupal 8 site and 8.x-2.0-beta4 is installed since before.
As per #9:
As per #12:
I run "composer update symfony/http-foundation egulias/email-validator drupal/core --with-dependencies" without problems.
I unset "bundle" as per #14.
I run "drush updb" and it gives the error:
TypeError: Argument 3 passed to DrupalviewsEntityViewsData::mapFieldDefinition() must implement interface DrupalCoreFieldFieldDefinitionInterface, null given, called in /home/xxx/core/modules/views/src/EntityViewsData.php on line 290 in DrupalviewsEntityViewsData->mapFieldDefinition() (line 387 of /home/xxx/core/modules/views/src/EntityViewsData.php).If i try to open the site in the browser, it is not possible. Instead I get the same error, but it also adds several other lines. The first one is:
"DrupalviewsEntityViewsData->mapFieldDefinition('profile', 'langcode', NULL, Object, Array) (Line: 290)"It doesn't help to update to file_entity 8.x-2.0-beta7.
Any suggestions?
(Everything seems to work fine if I just run "composer update" and then "drush updb". But I don't think just running "composer update" is recommended.)
Comment #44
dougiep commented@bengt please see Comment #6 at : https://www.drupal.org/project/drupal/issues/3058082#comment-13174026
It resolved the issue for me.
Comment #45
bengt commented@dougiep Thanks that did the trick!
So to be able to update (without using the command "composer update") from 8.6.16 to 8.7.6 I did the following:
1. Changed in core/composer.json: "egulias/email-validator": "^1.2" --> "egulias/email-validator": "^2.0"
2. Deleted the following from [root]/composer.json (see https://www.drupal.org/project/drupal/issues/3020337):
"merge-plugin": {
"include": [
"core/composer.json"
],
"recurse": false,
"replace": false,
"merge-extra": false
},
3. Run: composer update symfony/http-foundation egulias/email-validator drupal/core --with-dependencies
4. Patched /core/modules/views/src/EntityViewsData.php as suggested by @dougiep in #44.
5. Run: drush updb
No errors!
6. Run: drush cr
No errors!
Site seems to work fine! Only one notice:" Notice: Undefined index: langcode i Drupal\views\EntityViewsData->getViewsData() (row 292..." Is this notice somehow connected to the issue and the patch?
@dougiep or any one else: I have a few questions:
1. I did not unset "bundle" as per #14. Should I do that?
2. Will I need to patch EntityViewsData.php every time I do an update (if not a "real" solution has been committed by then)? Does this patch have any disadvantages? Is this patch needed because of a bug in Drupal core or because of a bug in a contributed module?
3. Should I run "composer require 'drupal/file_entity:^2.0'" as suggested in #21? Earlier betas do not seem to be compatible with Drupal 8.7.x.
4. Do you agree that one should not use the brute command "composer update" (which also did solve this issue)? Or can it be legitimate sometimes?
Comment #46
mmjvb commented1. unset bundle: Yes, you should do that.
2. patch EntityViewsData.php every time: Yes, unfortunately core committer qualifies it as a workaround. I disagree, despite the fact it is not a complete solution, if does fix bad code!
3.require file_entity: No idea whether that is a requirement.
4. composer update: advice against using it without whitelisting requirements. Consider current use of version constraints poor, so I won't rely on it. Default behavior is too optimistic for my liking. Obviously, you can use --dry-run to find out what it wants to do, run again without --dry-run when you agree. So, it is legitimate, just not what I want.
Comment #47
bengt commentedThanks @mmjvb!
If I understand you correctly, I should leave the patched EntityViewsData.php there after running "drush updb", and not put back the unpatched version. Correct?
Comment #48
vuilComment #49
mmjvb commentedYes, indeed. Keep those fixes. They are not solving the actual problem. They probably should log errors besides only running code in valid situations. Maybe even throw errors.
Also suggest to solve your issue properly. You converted drupal/drupal step by step instead of rebuilding your codebase starting with a proper distribution. With every issue you run into, you'll wonder whether that is caused by the bad start!
Comment #50
bengt commentedThanks @mmjvb!
I have seen these kind of comments about "drupal/drupal" and "proper distribution" before. In this case it is a bought template (with a full installation as a starting point) and in [root]/composer.json it says at the top '"name": "drupal/drupal"'. I have to confess that I haven't entered deeply into this "issue". Would you say that this commercial template have done it wrong? Is it posssible to "rebuild" this codebase now (it is a live website)? Can you direct me to a page which explains this "issue" and gives instructions how to "rebuild" codebase without crashing the site?
Comment #51
mmjvb commentedBased on the information provided it is hard to say they have done it wrong. D.O. still points you to download drupal/drupal. It is still used for developers to contribute to drupal. Not sure I understand what you mean by bought template. Would expect to be able to use that template in any environment, including drupal/drupal. The mistake you made is to use it to become your site. For site building use a proper distribution. One that allows you to use composer to update things in your codebase, including drupal/core.
You can always rebuild your codebase, even for a live site. Suggest to dry-run it on a copy of the live site. There is always the danger of things going wrong. Every site is unique! As of D8, composer is used to create the distribution. That still allows you to maintain your site the traditional way. There are even sites that don't use composer at all. With composer the rebuild becomes very easy, composer is only concerned with the codebase. It doesn't touch the database, yet. Normally speaking your site doesn't depend on the organization of the codebase. However, there are situations where it does.
Not aware of documentation on rebuilding codebase. It does resemble activity involved in moving a site. Instead of using existing codebase, build a new one and point to the database.
Comment #52
bengt commentedThanks @mmjvb!
Comment #53
edward.radau commentedI'm running into this error right after disabling the multiversion module. Do not know if it's related