mjordan/islandora_bagger_integration

Error when creating bag in local mode

Closed this issue · 4 comments

I am trying to bag a node in local mode with just the default sample configuration file on Drupal 9 but that brings up a page with the message: "The website encountered an unexpected error. Please try again later.".
In the logs:

Message | Error: Non-static method Drupal\Core\File\FileSystemInterface::getTempDirectory() cannot be called statically in Drupal\islandora_bagger_integration\Plugin\Form\IslandoraBaggerForm->submitForm() (line 95 of /var/www/drupalvm/drupal/web/modules/contrib/islandora_bagger_integration/src/Plugin/Form/IslandoraBaggerForm.php)
#0 [internal function]: Drupal\islandora_bagger_integration\Plugin\Form\IslandoraBaggerForm->submitForm() 
#1 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormSubmitter.php(113): call_user_func_array() 
#2 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() 
#3 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormSubmitter->doSubmitForm() 
#4 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm() #5 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(219): Drupal\Core\Form\FormBuilder->buildForm() 
#6 /var/www/drupalvm/drupal/web/modules/contrib/islandora_bagger_integration/src/Plugin/Block/BagitBlock.php(23): Drupal\Core\Form\FormBuilder->getForm() 
#7 /var/www/drupalvm/drupal/web/core/modules/block/src/BlockViewBuilder.php(171): Drupal\islandora_bagger_integration\Plugin\Block\BagitBlock->build() #8 [internal function]: Drupal\block\BlockViewBuilder::preRender() 
#9 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(101): call_user_func_array() 
#10 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(781): Drupal\Core\Render\Renderer->doTrustedCallback() 
#11 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(372): Drupal\Core\Render\Renderer->doCallback() 
#12 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(444): Drupal\Core\Render\Renderer->doRender() 
#13 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender() #14 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Template/TwigExtension.php(450): Drupal\Core\Render\Renderer->render() 
#15 /var/www/drupalvm/drupal/web/sites/default/files/php/twig/60ef3558257da_page.html.twig_vrHJ_A8rqTuJTJ24V1SnLJv3p/msfOet7Iffl2cLbsP9AMzbsL92LSX33mJV7vk6bCVyE.php(97): Drupal\Core\Template\TwigExtension->escapeFilter() 
#16 /var/www/drupalvm/drupal/vendor/twig/twig/src/Template.php(405): __TwigTemplate_2e5f099d4930a5a65671103cff982b55ce809f330a1bba62a8ba26d4a9f6f68e->doDisplay() 
#17 /var/www/drupalvm/drupal/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling() 
#18 /var/www/drupalvm/drupal/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#19 /var/www/drupalvm/drupal/web/core/themes/engines/twig/twig.engine(65): Twig\Template->render() 
#20 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template() 
#21 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(431): Drupal\Core\Theme\ThemeManager->render() 
#22 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender() 
#23 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Template/TwigExtension.php(450): Drupal\Core\Render\Renderer->render() 
#24 /var/www/drupalvm/drupal/web/sites/default/files/php/twig/60ef3558257da_html.html.twig_Js96Y90fpLj1kJH5xNmfTizg6/Vf1hEbsYePGqTd4vt6937-Uw8OFLtAlPBrDXsOWojRE.php(86): Drupal\Core\Template\TwigExtension->escapeFilter() 
#25 /var/www/drupalvm/drupal/vendor/twig/twig/src/Template.php(405): __TwigTemplate_c696d220ba5928c6a82cc3ef72a01b4337f1c9106a0e55273dff0925751dbdb4->doDisplay() 
#26 /var/www/drupalvm/drupal/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling() 
#27 /var/www/drupalvm/drupal/vendor/twig/twig/src/Template.php(390): Twig\Template->display()
#28 /var/www/drupalvm/drupal/web/core/themes/engines/twig/twig.engine(65): Twig\Template->render() 
#29 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template() 
#30 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(431): Drupal\Core\Theme\ThemeManager->render() 
#31 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(200): Drupal\Core\Render\Renderer->doRender() 
#32 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(162): Drupal\Core\Render\Renderer->render() 
#33 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#34 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(163): Drupal\Core\Render\Renderer->executeInRenderContext() 
#35 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() 
#36 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() 
#37 /var/www/drupalvm/drupal/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func() 
#38 /var/www/drupalvm/drupal/vendor/symfony/http-kernel/HttpKernel.php(163): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() 
#39 /var/www/drupalvm/drupal/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\Component\HttpKernel\HttpKernel->handleRaw() 
#40 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle() 
#41 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle() 
#42 /var/www/drupalvm/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle() 
#43 /var/www/drupalvm/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass() 
#44 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle() 
#45 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() 
#46 /var/www/drupalvm/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() 
#47 /var/www/drupalvm/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(716): Stack\StackedHttpKernel->handle() 
#48 /var/www/drupalvm/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle() 
#49 {main}

This is line 95 of IslandoraBaggerForm.php that is causing the error,

$tmp_dir = \Drupal\Core\File\FileSystemInterface::getTempDirectory();

Any suggestions on how to fix this?
Thanks in advance.

@johnguirgis I'm very sorry I didn't see this earlier. I'll look into this.

@johnguirgis can you pull in the issue-26 branch of this repo to see if it eliminates the problem?

Thanks @mjordan this does fix the issue.

Great, thanks for finding it and for testing.