pdir / social-feed-bundle

Social feed extension for Contao CMS
GNU Lesser General Public License v3.0
13 stars 15 forks source link

There is currently no session available. #152

Open leon1995 opened 1 month ago

leon1995 commented 1 month ago

Bug description

[2024-09-27T13:23:27.978779+02:00] app.ERROR: Symfony\Component\HttpFoundation\Exception\SessionNotFoundException: There is currently no session available. in /usr/www/users/oststes/osvproduction/vendor/symfony/http-foundation/RequestStack.php:107 Stack trace: #0 /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/contao/library/Contao/Message.php(104): Symfony\Component\HttpFoundation\RequestStack->getSession() #1 /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/contao/library/Contao/Message.php(36): Contao\Message::add() #2 /usr/www/users/oststes/osvproduction/vendor/pdir/social-feed-bundle/src/Importer/Importer.php(50): Contao\Message::addError() #3 /usr/www/users/oststes/osvproduction/vendor/pdir/social-feed-bundle/src/Cron/InstagramImportCron.php(83): Pdir\SocialFeedBundle\Importer\Importer->getInstagramPosts() #4 /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/src/Cron/CronJob.php(44): Pdir\SocialFeedBundle\Cron\InstagramImportCron->__invoke() #5 /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/src/Cron/Cron.php(197): Contao\CoreBundle\Cron\CronJob->__invoke() #6 /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/src/Cron/Cron.php(182): Contao\CoreBundle\Cron\Cron->executeCrons() #7 /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/src/Cron/Cron.php(97): Contao\CoreBundle\Cron\Cron->doRun() #8 /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/src/EventListener/CommandSchedulerListener.php(42): Contao\CoreBundle\Cron\Cron->run() #9 /usr/www/users/oststes/osvproduction/vendor/symfony/event-dispatcher/EventDispatcher.php(260): Contao\CoreBundle\EventListener\CommandSchedulerListener->__invoke() #10 /usr/www/users/oststes/osvproduction/vendor/symfony/event-dispatcher/EventDispatcher.php(220): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() #11 /usr/www/users/oststes/osvproduction/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners() #12 /usr/www/users/oststes/osvproduction/vendor/symfony/http-kernel/HttpKernel.php(115): Symfony\Component\EventDispatcher\EventDispatcher->dispatch() #13 /usr/www/users/oststes/osvproduction/vendor/symfony/http-kernel/Kernel.php(157): Symfony\Component\HttpKernel\HttpKernel->terminate() #14 /usr/www/users/oststes/osvproduction/vendor/symfony/http-kernel/HttpCache/HttpCache.php(262): Symfony\Component\HttpKernel\Kernel->terminate() #15 /usr/www/users/oststes/osvproduction/public/index.php(46): Symfony\Component\HttpKernel\HttpCache\HttpCache->terminate() #16 {main} [] {"request_uri":"https://www.mydomainredacted.de/_fragment?_hash=8hCp5YVlXycUPTr5ggGr5uXBMFP3av99Z%2BY8kDVaimo%3D&_path=insertTag%3D%257B%257Bdate%253A%253AY%257D%257D%26_scope%3Dfrontend%26_format%3Dhtml%26_locale%3Dde%26_controller%3DContao%255CCoreBundle%255CController%255CInsertTagsController%253A%253ArenderAction&clientCache=0&pageId=2&request=%2F","request_method":"GET"}
[2024-09-27T13:23:27.981176+02:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\HttpFoundation\Exception\SessionNotFoundException: "There is currently no session available." at RequestStack.php line 107 {"exception":"[object] (Symfony\\Component\\HttpFoundation\\Exception\\SessionNotFoundException(code: 0): There is currently no session available. at /usr/www/users/oststes/osvproduction/vendor/symfony/http-foundation/RequestStack.php:107)"} {"request_uri":"https://www.mydomainredacted.de/_fragment?_hash=8hCp5YVlXycUPTr5ggGr5uXBMFP3av99Z%2BY8kDVaimo%3D&_path=insertTag%3D%257B%257Bdate%253A%253AY%257D%257D%26_scope%3Dfrontend%26_format%3Dhtml%26_locale%3Dde%26_controller%3DContao%255CCoreBundle%255CController%255CInsertTagsController%253A%253ArenderAction&clientCache=0&pageId=2&request=%2F","request_method":"GET"}
[2024-09-27T13:23:27.984071+02:00] php.WARNING: Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/oststes/osvproduction/vendor/symfony/http-foundation/Response.php:408) {"exception":"[object] (ErrorException(code: 0): Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/oststes/osvproduction/vendor/symfony/http-foundation/Response.php:408) at /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/src/HttpKernel/Header/NativeHeaderStorage.php:29)"} {"request_uri":"https://www.mydomainredacted.de/_fragment?_hash=8hCp5YVlXycUPTr5ggGr5uXBMFP3av99Z%2BY8kDVaimo%3D&_path=insertTag%3D%257B%257Bdate%253A%253AY%257D%257D%26_scope%3Dfrontend%26_format%3Dhtml%26_locale%3Dde%26_controller%3DContao%255CCoreBundle%255CController%255CInsertTagsController%253A%253ArenderAction&clientCache=0&pageId=2&request=%2F","request_method":"GET"}
[2024-09-27T13:23:27.984263+02:00] php.WARNING: Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/oststes/osvproduction/vendor/symfony/http-foundation/Response.php:408) {"exception":"[object] (ErrorException(code: 0): Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/oststes/osvproduction/vendor/symfony/http-foundation/Response.php:408) at /usr/www/users/oststes/osvproduction/vendor/contao/core-bundle/src/HttpKernel/Header/NativeHeaderStorage.php:29)"} {"request_uri":"https://www.mydomainredacted.de/_fragment?_hash=8hCp5YVlXycUPTr5ggGr5uXBMFP3av99Z%2BY8kDVaimo%3D&_path=insertTag%3D%257B%257Bdate%253A%253AY%257D%257D%26_scope%3Dfrontend%26_format%3Dhtml%26_locale%3Dde%26_controller%3DContao%255CCoreBundle%255CController%255CInsertTagsController%253A%253ArenderAction&clientCache=0&pageId=2&request=%2F","request_method":"GET"}
[2024-09-27T13:23:28.044064+02:00] messenger.INFO: Stopping worker. {"transport_names":["contao_prio_high"]} {"request_uri":"https://www.mydomainredacted.de/_fragment?_hash=8hCp5YVlXycUPTr5ggGr5uXBMFP3av99Z%2BY8kDVaimo%3D&_path=insertTag%3D%257B%257Bdate%253A%253AY%257D%257D%26_scope%3Dfrontend%26_format%3Dhtml%26_locale%3Dde%26_controller%3DContao%255CCoreBundle%255CController%255CInsertTagsController%253A%253ArenderAction&clientCache=0&pageId=2&request=%2F","request_method":"GET"}

Im Forum hieß es, dass Contao\Message::add() nur in einem webrequest benutzt werden kann, nicht in einem cron job.

Bundle Version

2.13.4

Environment

contao 5.3.15, php 8.3.11

leon1995 commented 5 days ago

Hat sich hier schon was getan? Das ist ziemlich nervig, weil man teilweise die Seite neuladen muss, da die Netzwerkverbindung beim ersten Aufruf unterbrochen wird

fritzmg commented 5 days ago

@leon1995 if you only use the free version, you could hire pdir - or another developer- to develop a fix and provide it as a PR.