Successfully installed the module and got it running, but at some point between intial install success and performing simple actions (changing the duration format & editing a field) the http://www.oursite.org/admin/content/brightcove_video page stopped working. From the browser we see:

The website encountered an unexpected error. Please try again later.

And in the Apache logs:

Error: Call to a member function getFileUri() on null in /var/www/something/htdocs/modules/brightcove/src/BrightcoveVideoListBuilder.php on line 129...

D8.2.7
Brightcove 8.x-1.2

CommentFileSizeAuthor
#10 video-list-image-check-2867884-10.patch750 bytesyce
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

justkristin created an issue. See original summary.

justkristin’s picture

Just upgraded Drupal to 8.3, and now the whole site is down! The apache log is full of:

[Fri Apr 07 15:54:19.538895 2017] [:error] [pid 17953] [client 199.106.195.8:44146] Error: Class 'Brightcove\\API\\Client' not found in /var/www/www.oursite.org/htdocs/modules/brightcove/src/EventSubscriber/Brightcove... on line 21 #0 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Component/EventDispatcher/Contain...(111): Drupal\\brightcove\\EventSubscriber\\BrightcoveInitSubscriber->initializeBrightcoveClient(Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent), 'kernel.request', Object(Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher))\n#1 /var/www/www.oursite.org/htdocs/vendor/symfony/http-kernel/HttpKernel.php(125): Drupal\\Component\\EventDispatcher\\ContainerAwareEventDispatcher->dispatch('kernel.request', Object(Symfony\\Component\\HttpKernel\\Event\\GetResponseEvent))\n#2 /var/www/www.oursite.org/htdocs/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#3 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#4 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHan...(47): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#5 /var/www/www.oursite.org/htdocs/core/modules/page_cache/src/StackMiddleware/PageC...(99): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#6 /var/www/www.oursite.org/htdocs/core/modules/page_cache/src/StackMiddleware/PageC...(78): Drupal\\page_cache\\StackMiddleware\\PageCache->pass(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#7 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxy...(47): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#8 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationM...(50): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#9 /var/www/www.oursite.org/htdocs/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#10 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/DrupalKernel.php(656): Stack\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#11 /var/www/www.oursite.org/htdocs/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#12 {main}

Attempt to uninstall Brightcove went like this:

root@kids02:/var/www/www.oursite.org/htdocs/themes/atkids# drush pm-uninstall brightcove
To uninstall brightcove, the following extensions must be uninstalled first: brightcove_proxy, media_entity_brightcove [error]
There were no extensions that could be uninstalled. [ok]
root@kids02:/var/www/www.oursite.org/htdocs/themes/atkids# drush pm-uninstall brightcove_proxy, media_entity_brightcove
The following extensions will be uninstalled: brightcove_proxy, media_entity_brightcove
Do you really want to continue? (y/n): y
brightcove_proxy was successfully uninstalled. [ok]
media_entity_brightcove was successfully uninstalled. [ok]
root@kids02:/var/www/www.oursite.org/htdocs/themes/atkids# drush pm-uninstall brightcove
The following extensions will be uninstalled: brightcove
Do you really want to continue? (y/n): y
Drupal\Core\Extension\ModuleUninstallValidatorException: The following reasons prevent the modules from being uninstalled: There is content for the entity type: Brightcove Playlist. Remove brightcove playlist entities., There is content for the entity type: Brightcove Video. href="/admin/modules/uninstall/entity/brightcove_video">Remove brightcove video entities., There is content for the entity type: Brightcove Player. Remove brightcove player entities. in /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/Extension/ModuleInstaller.ph...
Stack trace:
#0 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/ProxyClass/Extension/ModuleI...(91): Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#1 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(227): Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#2 phar:///usr/local/bin/drush/commands/core/drupal/pm_8.inc(82): drush_module_uninstall(Array)
#3 phar:///usr/local/bin/drush/commands/pm/pm.drush.inc(1237): _drush_pm_uninstall(Array)
#4 phar:///usr/local/bin/drush/includes/command.inc(422): drush_pm_uninstall('brightcove')
#5 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#6 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command('brightcove')
#7 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#8 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#9 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
#10 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
#11 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#12 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#13 {main}

Help?

jan.mashat’s picture

Status: Active » Postponed (maintainer needs more info)

The 1st error:
Call to a member function getFileUri() on null in /var/www/something/htdocs/modules/brightcove/src/BrightcoveVideoListBuilder.php on line 129

Points to this section of the source code:

    // Get thumbnail image style and render it.
    $thumbnail = $entity->getThumbnail();
    $thumbnail_image = '';
    if (!empty($thumbnail['target_id'])) {
      /** @var \Drupal\file\Entity\File $thumbnail_file */
      $thumbnail_file = File::load($thumbnail['target_id']);
      /** @var \Drupal\image\Entity\ImageStyle $image_style */
      $image_style = ImageStyle::load('brightcove_videos_list_thumbnail');
      if (!is_null($image_style)) {
        $image_uri = $image_style->buildUrl($thumbnail_file->getFileUri());
        $thumbnail_image = "<img src='{$image_uri}' alt='{$entity->getName()}'>";
      }
    }

Which raises the question: have you modified the thumbnail image style?

The 2nd error:
Class 'Brightcove\\API\\Client' not found
Means that the PHP-API-Wrapper library was not found. This was probably caused by the core upgrade overwriting composer.json and one way to resolve that may have been to repeat the "Install library dependency (PHP-API-Wrapper)" step in the installation guide.

As for the 3rd error:
The following reasons prevent the modules from being uninstalled: There is content for the entity type: Brightcove Playlist. Remove brightcove playlist entities., There is content for the entity type: Brightcove Video. href="/admin/modules/uninstall/entity/brightcove_video">Remove brightcove video entities., There is content for the entity type: Brightcove Player. Remove brightcove player entities.
You need to remove the content before uninstalling the module.

Without further further knowledge of what could have caused the 1st error, the fastest way to get back up and running may be to restore a DB backup taken before the changes were made, or - if a backup is not available - start over with a fresh site drush sql-dump > ../backup-broken.sql && drush sql-drop.

In addition to following the installation guide (linked above) for the installation and configuration of the module and library, I recommend reading Parts 3 & 4 of the Brightcove Video Connect for Drupal 8 blog series for a detailed explanation on proper usage of the module.

Please do, however, post the steps you took which could have caused the 1st error so we can determine whether the issue is reproducible and requires remedy.

justkristin’s picture

Thank you, sir. Because of a DisplaySuite/8.3 cluster f (I updated core to see if it would fix the error), we had to roll back a day. There is still a problem with thumbnails, but I will have to dig in again once the rest of the furor subsides.

justkristin’s picture

Ok, sir. Sorry about the lag - yay, Jury Duty! :) I have rolled back as far as I could, but am still getting error number one. Starting fresh is not an option at this time, unfortunately. I will ask my designer if he messed with the thumbnail display settings, but would it matter if he had? At the moment, I can view the playlists using the content tab for them, but when I try to view videos using the video content tab, all I get is:

The website encountered an unexpected error. Please try again later.

The error that shows in the apache logs is:

[Mon Apr 17 12:24:48.640922 2017] [:error] [pid 3041] [client 199.106.195.8:52371] Error: Call to a member function getFileUri() on null in /var/www/www.oursite.org/htdocs/modules/brightcove/src/BrightcoveVideoListBuilder... on line 129 #0 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/Entity/EntityListBuilder.php(229): Drupal\\brightcove\\BrightcoveVideoListBuilder->buildRow(Object(Drupal\\brightcove\\Entity\\BrightcoveVideo))\n#1 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/Entity/Controller/EntityList...(22): Drupal\\Core\\Entity\\EntityListBuilder->render()\n#2 [internal function]: Drupal\\Core\\Entity\\Controller\\EntityListController->listing('brightcove_vide...')\n#3 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderi...(123): call_user_func_array(Array, Array)\n#4 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}()\n#5 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderi...(124): Drupal\\Core\\Render\\Renderer->executeInRenderContext(Object(Drupal\\Core\\Render\\RenderContext), Object(Closure))\n#6 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/EventSubscriber/EarlyRenderi...(97): Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)\n#7 [internal function]: Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}()\n#8 /var/www/www.oursite.org/htdocs/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Object(Closure), Array)\n#9 /var/www/www.oursite.org/htdocs/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#10 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#11 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/KernelPreHan...(47): Drupal\\Core\\StackMiddleware\\Session->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#12 /var/www/www.oursite.org/htdocs/core/modules/page_cache/src/StackMiddleware/PageC...(99): Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#13 /var/www/www.oursite.org/htdocs/core/modules/page_cache/src/StackMiddleware/PageC...(78): Drupal\\page_cache\\StackMiddleware\\PageCache->pass(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#14 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/ReverseProxy...(47): Drupal\\page_cache\\StackMiddleware\\PageCache->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#15 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/StackMiddleware/NegotiationM...(50): Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#16 /var/www/www.oursite.org/htdocs/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#17 /var/www/www.oursite.org/htdocs/core/lib/Drupal/Core/DrupalKernel.php(652): Stack\\StackedHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#18 /var/www/www.oursite.org/htdocs/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#19 {main}, referer: http://devwww.oursite.org/admin/content

Thank you so much for your help!

justkristin’s picture

Tried applying patch in #58 here, but no love:
https://www.drupal.org/node/2705925#comment-11713583

justkristin’s picture

Still stuck at Error: Call to a member function getFileUri() on null in /var/www/www.oursite.org/htdocs/modules/brightcove/src/BrightcoveVideoListBuilder... when I try to view videos (but not playlists - they show up just fine). Can anyone tell me how to proceed debugging this? We are close to 2/3 done, so a rebuild is not an option...

justkristin’s picture

Videos chosen in fields are also not showing up in the published content, despite no errors in browser console, or apache logs

justkristin’s picture

Have done some more poking, and the thumbnail image style is there and fine, and the thumbnails are also there when I create a view... It is solely a problem with the video admin page...

yce’s picture

Hi,

I've checked the issue, and looks like the file which was belong to the BrightcoveVideo entity was deleted, that's why the list shows an error because it tries to load it.

I'm working on a solution, which will take care of the deleted files on the entity properly.

In the meantime you can apply the patch which I've uploaded to get around the error.

jan.mashat’s picture

Assigned: Unassigned » yce
Status: Postponed (maintainer needs more info) » Needs work
justkristin’s picture

The patch in #10 works so far! Thank you! :)

  • 2b6b16f committed on 8.x-1.x
    Issue #2867884: Remove poster/thumbnail file reference, if the file...
  • 40fdc8f committed on 8.x-1.x
    Issue #2867884: Don't try to show thumbnail image if not exist.
    
  • 52bcfa6 committed on 8.x-1.x
    Issue #2867884: Remove invalid poster/thumbnail file references from...
yce’s picture

@justkristin, I've uploaded the fix to the latest dev version.

There is an update hook which will take care of the invalid references on the BrightcoveVideo entities, so after running the updates, and re-syncing the video, you should get back the missing images from Brightcove (of course only if you haven't already updated any of the videos with missing images).

jan.mashat’s picture

Assigned: yce » Boobaa
Status: Needs work » Needs review

  • 73a8efe committed on 8.x-1.x
    Issue #2867884: Exit update if there are no BrightcoveVideo entities to...
Boobaa’s picture

Assigned: Boobaa » yce
Status: Needs review » Needs work

Needs some minor adjustments, eg. don't throw a fatal (division by zero) when there's nothing to update, and no need to save the entity twice if both images are gone.

  • a532f99 committed on 8.x-1.x
    Issue #2867884: Don't save twice the BrightcoveVideo entity if both...
yce’s picture

Assigned: yce » Boobaa
Status: Needs work » Needs review

Fixed the issues, thanks for the review.

Boobaa’s picture

Assigned: Boobaa » Unassigned
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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