When I test the result of…

https://www.mywebsite.com/en/sitemap.xml

…I get the following error:

Current context:
Sitemap: Drupal\xmlsitemap\Entity\XmlSitemap Object ( [uri] => [id] => g3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc [label] => https://www.mywebsite.com/en/ [chunks] => 1 [links] => 36 [max_filesize] => 5923 [context] => Array ( [language] => en ) [updated] => 1518430117 [originalId:protected] => g3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc [status:protected] => 1 [uuid:protected] => c35057ff-5022-4475-80f3-11d62334fc4a [isSyncing:Drupal\Core\Config\Entity\ConfigEntityBase:private] => [isUninstalling:Drupal\Core\Config\Entity\ConfigEntityBase:private] => [langcode:protected] => de [third_party_settings:protected] => Array ( ) [_core:protected] => Array ( ) [trustedData:protected] => [entityTypeId:protected] => xmlsitemap [enforceIsNew:protected] => [typedData:protected] => [cacheContexts:protected] => Array ( [0] => languages:language_interface ) [cacheTags:protected] => Array ( ) [cacheMaxAge:protected] => -1 [_serviceIds:protected] => Array ( ) [dependencies:protected] => Array ( ) )
Chunk: 1
Cache file location: public://xmlsitemap/g3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc/1.xml
Cache file exists: Yes 

And in the log:

Notice: Undefined variable: context in Drupal\xmlsitemap\Controller\XmlSitemapController->renderSitemapXml() (line 80 of /home/myaccount/www/mywebsite.com/docroot/modules/contrib/xmlsitemap/src/Controller/XmlSitemapController.php) #0 /home/myaccount/www/mywebsite.com/docroot/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Undefined varia...', '/home/myaccount/...', 80, Array) #1 /home/myaccount/www/mywebsitecom/docroot/modules/contrib/xmlsitemap/src/Controller/XmlSitemapController.php(80): _drupal_error_handler(8, 'Undefined varia...', '/home/myaccount/...', 80, Array) #2 [internal function]: Drupal\xmlsitemap\Controller\XmlSitemapController->renderSitemapXml() #3 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #4 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/Render/Renderer.php(576): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #5 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #6 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #7 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #8 /home/myaccount/www/mywebsite.com/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #9 /home/myaccount/www/mywebsite.com/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #10 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /home/myaccount/www/mywebsite.com/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /home/myaccount/www/mywebsite.com/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /home/myaccount/www/mywebsite.com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /home/myaccount/www/mywebsite.com/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #19 {main}.Notice: Undefined variable: context in Drupal\xmlsitemap\Controller\XmlSitemapController->renderSitemapXml() (line 80 of /home/myaccount/www/mywebsite.com/docroot/modules/contrib/xmlsitemap/src/Controller/XmlSitemapController.php) #0 /home/myaccount/www/mywebsite.com/docroot/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Undefined varia...', '/home/myaccount/...', 80, Array) #1 /home/myaccount/www/mywebsitecom/docroot/modules/contrib/xmlsitemap/src/Controller/XmlSitemapController.php(80): _drupal_error_handler(8, 'Undefined varia...', '/home/myaccount/...', 80, Array) #2 [internal function]: Drupal\xmlsitemap\Controller\XmlSitemapController->renderSitemapXml() #3 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #4 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/Render/Renderer.php(576): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #5 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #6 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #7 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #8 /home/myaccount/www/mywebsite.com/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #9 /home/myaccount/www/mywebsite.com/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #10 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /home/myaccount/www/mywebsite.com/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /home/myaccount/www/mywebsite.com/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /home/myaccount/www/mywebsite.com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /home/myaccount/www/mywebsite.com/docroot/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /home/myaccount/www/mywebsite.com/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #19 {main}.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Thomas Factory created an issue. See original summary.

Helrunar’s picture

Please deactivate the Developer Mode in your settings (advanced settings) and all should work fine

jmoruzi’s picture

I have the same error. I disabled the Dev module, deleted and created new sitemaps (en and fr) and still have the same error.

XML sitemap 8.x-1.0-alpha2
Drupal 8.4.2

Current context:
Sitemap: Drupal\xmlsitemap\Entity\XmlSitemap Object ( [uri] => [id] => g3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc [label] => Callisto (en) [chunks] => 1 [links] => 31 [max_filesize] => 5604 [context] => Array ( [language] => en ) [updated] => 1520096018 [originalId:protected] => g3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc [status:protected] => 1 [uuid:protected] => ab36b547-8e01-48d5-b381-51c059b633ae [isSyncing:Drupal\Core\Config\Entity\ConfigEntityBase:private] => [isUninstalling:Drupal\Core\Config\Entity\ConfigEntityBase:private] => [langcode:protected] => en [third_party_settings:protected] => Array ( ) [_core:protected] => Array ( ) [trustedData:protected] => [entityTypeId:protected] => xmlsitemap [enforceIsNew:protected] => [typedData:protected] => [cacheContexts:protected] => Array ( [0] => languages:language_interface ) [cacheTags:protected] => Array ( ) [cacheMaxAge:protected] => -1 [_serviceIds:protected] => Array ( ) [dependencies:protected] => Array ( ) )
Chunk: 1
Cache file location: public://xmlsitemap/g3XYqcXbSKPVBDODwnT6pq7oqhCFkPryj4vVqrl_Kfc/1.xml
Cache file exists: Yes
pifagor’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot create this problem (Drupal 8.4.4). Step by step how to retroduce, and which additional modules are installed on the site.

gr8tkicks’s picture

Yeah having same issue here:

Current context: Array ( ) 
Sitemap: Drupal\xmlsitemap\Entity\XmlSitemap Object ( [uri] => [id] => NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM [label] => https://ucsfpa1ode1.prod.acquia-sites.com [chunks] => 6 [links] => 13931 [max_filesize] => 561204 [context] => Array ( ) [updated] => 1553917620 [originalId:protected] => NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM [status:protected] => 1 [uuid:protected] => 1ea34a23-c60c-4b58-a478-3ed7fdfb7f1c [isSyncing:Drupal\Core\Config\Entity\ConfigEntityBase:private] => [isUninstalling:Drupal\Core\Config\Entity\ConfigEntityBase:private] => [langcode:protected] => en [third_party_settings:protected] => Array ( ) [_core:protected] => Array ( ) [trustedData:protected] => [entityTypeId:protected] => xmlsitemap [enforceIsNew:protected] => [typedData:protected] => [cacheContexts:protected] => Array ( ) [cacheTags:protected] => Array ( ) [cacheMaxAge:protected] => -1 [_serviceIds:protected] => Array ( ) [_entityStorages:protected] => Array ( ) [dependencies:protected] => Array ( ) ) 
Chunk: index 
Cache file location: public://sitemap.xml/NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM/index.xml 
Cache file exists: Yes 

I disable DEV and output of errors, and ran the cron (had to up limit to 756megs to get cron to run) , there is about 13940 nodes we are indexing but the cron said the "The sitemaps were regenerated. " so I dont get why the file called sitemap.xml is throwing an error. Especially since isn't suppose to be a static file?

gr8tkicks’s picture

Providing more context please see screenshot in attacked files section.

So it generated roughly 15 XML files along with and index.xml file.

But again when you go and try to load the sitemap.xml file from Drupal at /sitemap.xml the error above occurs. Files are located in docroot/sites/default/files/sitemap/HASH/...

Dave Reid’s picture

Category: Bug report » Support request
Status: Postponed (maintainer needs more info) » Fixed

It appears you have the 'Developer mode' enabled, which shows you debugging information when requesting the sitemap path, instead of the actual content. If you disable this setting in the XML sitemap module settings, it should work as expected.

Status: Fixed » Closed (fixed)

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