TypeError: Argument 1 passed to BridEntityResolver::getFieldItemList() must implement interface FieldableEntityInterface, null given

Created on 3 October 2023, 12 months ago

Problem/Motivation

While researching issues with bridtv videos not getting synced as expected I found the following error in our logs :

TypeError: Argument 1 passed to Drupal\bridtv\BridEntityResolver::getFieldItemList() must implement interface Drupal\Core\Entity\FieldableEntityInterface, null given, called in /data/versions/2023-09-25_15-32-51/public/magazin/modules/contrib/bridtv/src/Plugin/QueueWorker/BridSyncWorker.php on line 142 in Drupal\bridtv\BridEntityResolver->getFieldItemList() (Zeile 121 in /data/versions/2023-09-25_15-32-51/public/magazin/modules/contrib/bridtv/src/BridEntityResolver.php) 

This seems to happen because the media entity referenced in the queue does not exist (anymore).

Steps to reproduce

I am not 100% sure about it but the following should work:

  1. Create more than 5 bridTV videos
  2. Run cron to start syncing them*
  3. While syncing delete one media entity, which was not yet synced but which entity ID is already in cron table

Currently I do not have demo content on bridtv to play with to reproduce the issue. I guess it's not very likely to run in such an issue, but we did.

Proposed resolution

Check if entity was loaded successfully.

Remaining tasks

Fix code.

🐛 Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

🇩🇪Germany osopolar 🇩🇪 GER 🌐

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

Comments & Activities

Production build 0.71.5 2024