Media types with missing source fields break the status report page

Created on 15 January 2020, over 4 years ago
Updated 9 February 2023, over 1 year ago

Problem/motivation

If a media type's source field is deleted, fatal errors can occur on the status report page.

This is mostly by design; the media system assumes the source field exists and does not try to gracefully handle missing source fields. That said, a missing source field probably shouldn't cause a fatal error on the status report. It's one thing for that to happen on pages that are specific to the media system, but our code could be a little more graceful in hook_requirements().

Proposed resolution

In media_requirements(), silently skip over media types whose source field is missing. In #3205866: media_requirements() should report missing source fields β†’ , we should actually make the hook report the missing source fields as actionable errors.

Remaining tasks

Open the aforementioned follow-up, then review and commit the patch.

API changes

None.

Data model changes

None.

UI changes

None.

Release notes snippet

None needed.

πŸ› Bug report
Status

Fixed

Version

9.1

Component
MediaΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡«πŸ‡·France Drupaldev2013

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

Comments & Activities

Not all content is available!

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

  • πŸ‡ΊπŸ‡ΈUnited States loopy1492

    It is still possible to get this error from time to time. In our case, it was because one of the many strange updates to Lightning Media did not get captured in config at some point.

    MEDIA: The source field definition for the Remote video media type is missing.

    Sadly, the real solution as far as I can tell is to hunt down the config file for the media type and find the source field definition for it. So, for our specific case, I had to hunt down media.type.remote_video.yml and look for the source_configration.source_field in there. Fortunately, it wasn't blank and saw that it was field_media_oembed_video.

    I then did a files search for field_media_oembed_video. Of course, it wasn't in my default config folder so I had to go find it in the contrib folders. In the docroot/modules/contrib/lightning_media/modules/lightning_media_video/config/optional/ folder, I found both the field and the field storage configs:

    config/default/field.field.media.remote_video.field_media_oembed_video.yml
    config/default/field.storage.media.field_media_oembed_video.yml

    Finding the field storage was easy, but I had to kind of hope that remote_video.field_media_oembed_video would work since just plain field_media_oembed_video did not exist anywhere in the code base, contrib or custom.

    I imported the config and the errors disappeared. Previously, the field edit page for that media type was also broken and it is no longer broken.

Production build 0.69.0 2024