I am trying to add a relationship "file usage" to a view. I click the submit button, but the relationship never gets added and UI never closed. I can add other relationships as expected.


To replicate (with "standard" profile):

  1. Create a new view listing node content (no displays need to be added).
  2. Don't touch the base view config in any way (the default "title" field will be the only field, etc.)
  3. Add a File Usage "File" relationship via the UI

After these steps the relationship config dialog reports "The handler for this item is broken or missing" and no config form is displayed. The relationship can then be saved on the view (without configuration) but cannot be used.

Immediately upon adding the relationship an error similar to the following is printed in the views UI:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'fid' in 'field list': SELECT node_field_data.created AS node_field_data_created, node_field_data.nid AS nid, fid AS fid FROM {node_field_data} node_field_data WHERE (( (node_field_data.status = :db_condition_placeholder_0) )) ORDER BY node_field_data_created DESC LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 )

And a barrage of notices are logged, containing and/or repeating:

Notice: Undefined index: id in Drupal\views\Plugin\ViewsHandlerManager->getHandler() (line 109 of /var/www/drupal-8/core/modules/views/src/Plugin/ViewsHandlerManager.php).
Notice: Undefined variable: items in Drupal\views\Plugin\views\relationship\Broken->buildOptionsForm() (line 79 of /var/www/drupal-8/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php).
Notice: Undefined index: original_configuration in Drupal\views\Plugin\views\relationship\Broken->buildOptionsForm() (line 61 of /var/www/drupal-8/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php).
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

usrsbn created an issue. See original summary.

dawehner’s picture

Can you enable the display of errors on /admin/config/development/logging? This could give some more information to start with.
Are you sure you also don't see any kind of error in the javascript error console? Its often, especially in connection with ajax work, appearing there.

usrsbn’s picture

Sorry, maybe I was a bit unclear saying that there is no error message: I meant logging / watchdog gives me no error message. There is a message in my console telling me that ajax terminated abnormally, but as that was pretty obvious I didn't mention that.

cilefen’s picture

@usrsbn Please turn off JS aggregation on the performance admin screen, get us the exact console error. Also, there may be a web server PHP you could find.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

There is, if you enable it, some error message involved, quite sure about that.

usrsbn’s picture

@cilefen JS aggregation is off. Chromium console gave a bit more detail than Iceweasel. Heres the exact console error:
POST http://localhost:8080/drupal-8/admin/structure/views/ajax/add-handler/zeitungsdownload/block_1/relationship?_wrapper_format=drupal_ajax net::ERR_EMPTY_RESPONSE

Uncaught AjaxError: 
Eine AJAX-Anfrage ist abnormal beendet worden.
Im Folgenden finden Sie Debugging-Informationen.
Pfad: /drupal-8/admin/structure/views/ajax/add-handler/zeitungsdownload/block_1/relationship
Statustext: error
Antworttext: 
ReadyState: 0
cilefen’s picture

What is the server PHP error when that happens?

usrsbn’s picture

Today I finally made some progress. I'm now using drupal 8.0.2 and finally UI gives me this error:

Relationship: Broken/missing handler
The handler for this item is broken or missing. The following details are available:
Enabling the appropriate module will may solve this issue. Otherwise, check to see if there is a module update available.

and heres my logging info:
Notice: Undefined index: id in Drupal\views\Plugin\ViewsHandlerManager->getHandler() (line 109 of /var/www/drupal-8/core/modules/views/src/Plugin/ViewsHandlerManager.php).
Notice: Undefined variable: items in Drupal\views\Plugin\views\relationship\Broken->buildOptionsForm() (line 79 of /var/www/drupal-8/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php).
Notice: Undefined index: original_configuration in Drupal\views\Plugin\views\relationship\Broken->buildOptionsForm() (line 61 of /var/www/drupal-8/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php).

rjacobs’s picture

Version: 8.0.1 » 8.0.x-dev
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Active

I've encountered this issue several times recently as well, with multiple 8.0.x tagged releases and HEAD.

In addition to the errors logged and noted by usrsbn, the following message is printed via the views_ui (though not logged... I'm not sure if there is something distinct to my logging setup that would explain that though):

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'fid' in 'field list': SELECT node_field_data.created AS node_field_data_created, node_field_data.nid AS nid, fid AS fid FROM {node_field_data} node_field_data WHERE (( (node_field_data.status = :db_condition_placeholder_0) )) ORDER BY node_field_data_created DESC LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 )

This seems to occur under several different views configurations. Adding a "file usage" relationship simply appears to be impossible without resulting in a broken handler. I'm not aware of any current workaround.

I tweaked the issue summary slightly to capture error specifics.

rjacobs’s picture

Title: Views relationship file can not be added » Adding File Usage "File" relationship results in broken/missing handler
Issue summary: View changes

Additional clarification to title.

usrsbn’s picture

@rjacobs: thanks, that exactly what I get

Lendude’s picture

Component: views.module » file.module
Status: Active » Needs review
Issue tags: +VDC, +Needs tests
FileSize
2.37 KB

Turns out none of the relationships defined in FileViewsData.php have an id set for the handler.

Did some quick manual tests and this seems to help.

But oh boy does this need some tests! (and a more generic way of adding these relationships? Hardcoded adding them only to all the known core entities? Really? Feels very D7).

deensdale’s picture

Thanks Lendude, #12 fixed it for me in 8.0.3 and 8.1.0-beta2. My system is still in dev, so plenty of opportunity to test (and plenty of time to receive an official patch).

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dhendriks’s picture

Any progress on this?

dhendriks’s picture

I tested the patch in #12 on Drupal 8.1.10, and it doesn't solve the problem. I still get the same error dialog, a similar SQL query error, and 21 log entries.

dawehner’s picture

Yeah I'm also not convinced by that at all. We merge the standard relationship in there normally.

jptreen’s picture

Thanks Lendude, #12 also worked for me in 8.2.1

Shadowcub’s picture

#12 worked for me in 8.2.3. Thank you! Why isn't this fixed yet?

As a side note: It seems that the lines are off in 8.2.3; what I did was a manual patch, inserting " 'id' => 'standard' " after lines 129, 145, 164, 180, 200, 215, and 234.

Lendude’s picture

Why isn't this fixed yet?

Needs tests and probably a better (as in, more generic) fix then the thing I did in #12. The fix in #12 is fine for people needing an instant fix, but as a real fix we want to look at something better, like what @dawehner said in #18

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

takim’s picture

I m using drupal core 8.3.2 and this patch did not fix for me the error. Anybody knows or have any more patches for it?

/Takim

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

wadmiraal’s picture

Re-rolled patch for 8.4.x.

Will see if I can add some failing tests. Also, should the standard handler be set as the default (in which case, the fix should be in Views)?

wadmiraal’s picture

This contains a failing test for the file_to_user relationship. It can only pass if you apply the patch from #25.

Status: Needs review » Needs work

The last submitted patch, 26: views_file_relationships_broken-2628230-26.patch, failed testing. View results

wadmiraal’s picture

This contains a failing test for the file_to_user and user_to_file relationships. It can only pass if you apply the patch from #25.

Lendude’s picture

Status: Needs work » Needs review

Lets kick the testbot into motion and see if it fails.

wadmiraal’s picture

Status: Needs review » Needs work

Hold on, I'm working on 2 new tests, and refactoring the first 2 :-). I'll upload the patch in a few minutes.

wadmiraal’s picture

Status: Needs work » Needs review
FileSize
41.36 KB
39.92 KB

This refactors the tests, merging the 3 existing User/File relationship tests into a single Kernel test (instead of a Browser test), and adds a new Kernel test for Node/File relationships.

Again: these tests will fail unless the patch from #25 is applied.

Status: Needs review » Needs work

The last submitted patch, 31: views_file_relationships_broken-2628230-31.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.