When i configure sitemap in drupal 8 and try to rebuild this it is showing ajax error after that when i checked log message it pormpted
Drupal\xmlsitemap\XmlSitemapGenerationException: Could not open file public://xmlsitemap/NXhscRe0440PFpI5dSznEVgmauL25KojD7u4e9aZwOM/1.xml for writing. in Drupal\xmlsitemap\XmlSitemapWriter->openUri() (line 84 of /var/www/drupal8/modules/xmlsitemap/src/XmlSitemapWriter.php).

This error so i am not able to configure this module in my website.

Comments

sushilkr created an issue. See original summary.

sushilkr’s picture

Title: When i try to rebuild it is showing ajax error » Sitemap xml file is not working in drupal8
jghyde’s picture

using the .dev version.

As an admin user, when clicking on the "Rebuild" tab, you received a 500 error for the ajax.

When clicking on the "run cron" link in admin/report/status, XMLSitemap does not rebuild a sitemap and complains that the sitemap cache is empty.

The Recent Log entries indicates:

InvalidArgumentException: The URI '/' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 306 of /var/www/example.com/prod/htdocs/core/lib/Drupal/Core/Url.php).

I deleted the sitemap included with the module and created a new sitemap. The error I get this time is:

InvalidArgumentException: The URI '<front>' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 306 of /var/www/example.com/prod/htdocs/core/lib/Drupal/Core/Url.php).

sajiniantony’s picture

I tried installing the 8.x-1.0-alpha2.When i configure sitemap in drupal 8 and try to rebuild this it is showing ajax error.

Chayemor’s picture

I can confirm the error, I get the following report:

InvalidArgumentException: The URI '<front>' is invalid. You must use a valid URI scheme. in Drupal\Core\Url::fromUri() (line 280 of /var/www/vhosts/mysite.com/httpdocs/core/lib/Drupal/Core/Url.php).

Chayemor’s picture

I just found a way to generate the XML sitemap without that error provoking an exception, be sure to have your site's base URL set in Advanced Settings in admin/config/search/xmlsitemap/settings, under Default base URL.

deajan’s picture

Getting the same error here with Drupal 8.3.0 and xmlsitemap 8.x-1.0-alpha2

InvalidArgumentException : The URI '<front>' is invalid. You must use a valid URI scheme. dans Drupal\Core\Url::fromUri()
My front page is set to '/node'.

Anything I can do here ?

G42’s picture

#6 from Chayemor is important, 'the URI '/' is invalid' sounds like the default base url for your site was not set.

The original error 'Drupal\xmlsitemap\XmlSitemapGenerationException: Could not open file public://xmlsitemap' sounds like the xmlsitemap folder has not been created. Make sure it exists in your site's public files folder.

marciuz’s picture

I resolved with the full domain root in the Default base URL.
It seems that the default value (internally treated as ?) isn't recognized nor transformed by the system.

In other words, go to admin/config/search/xmlsitemap/settings
and in Advanced Settings -> Default Base URL,
set your full domain (e.g http://www.yourwebsite.com/).

This worked for me.

Dave Reid’s picture

Status: Active » Fixed

The issues with the or "The URI '/' is invalid" have been resolved in the latest versions of the module, I would encourage you to update and try it out.

Status: Fixed » Closed (fixed)

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