TypeError: Invalid URL while trying to build with sitemap not set to false
See original GitHub issueHave you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
Prerequisites
- I’m using the latest version of Docusaurus.
- I have tried the
npm run clear
oryarn clear
command. - I have tried
rm -rf node_modules yarn.lock package-lock.json
and re-installing packages. - I have tried creating a repro with https://new.docusaurus.io.
- I have read the console error message carefully (if applicable).
Description
I’m using v2.1.0 and I’ve noticed that I get an error when I want to create a production build with sitemap not set to false, the yarn run start
works with no issue, but when I run yarn run build
I get a build error. If I set the sitemap
option to false, it builds without errors. I use it as a blog only.
Reproducible demo
No response
Steps to reproduce
git clone https://gitlab.com/chreniuc/hreniuc-dev -b failed_build
cd hreniuc-dev
yarn install
yarn run build
Expected behavior
To build successfully.
Actual behavior
I’m receiving this error:
[ERROR] Unable to build website for locale en.
[ERROR] TypeError: Invalid URL
at new NodeError (node:internal/errors:372:5)
at URL.onParseError (node:internal/url:553:9)
at new URL (node:internal/url:629:5)
at new URL (node:internal/url:626:22)
at normalizeURL (/path/node_modules/sitemap/dist/lib/utils.js:274:15)
at SitemapStream._transform (/path/node_modules/sitemap/dist/lib/sitemap-stream.js:74:87)
at SitemapStream.Transform._write (node:internal/streams/transform:184:23)
at writeOrBuffer (node:internal/streams/writable:389:12)
at _write (node:internal/streams/writable:330:10)
at SitemapStream.Writable.write (node:internal/streams/writable:334:10)
at /path/node_modules/@docusaurus/plugin-sitemap/lib/createSitemap.js:44:57
at Array.forEach (<anonymous>)
at createSitemap (/path/node_modules/@docusaurus/plugin-sitemap/lib/createSitemap.js:44:20)
at Object.postBuild (/path/node_modules/@docusaurus/plugin-sitemap/lib/index.js:23:72)
at /path/node_modules/@docusaurus/core/lib/commands/build.js:171:22
at Array.map (<anonymous>)
at buildLocale (/path/node_modules/@docusaurus/core/lib/commands/build.js:167:31)
at async tryToBuildLocale (/path/node_modules/@docusaurus/core/lib/commands/build.js:38:20)
at async mapAsyncSequential (/path/node_modules/@docusaurus/utils/lib/jsUtils.js:34:24)
at async Command.build (/path/node_modules/@docusaurus/core/lib/commands/build.js:73:21)
[INFO] Docusaurus version: 2.1.0
Node version: v16.15.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Your environment
- Public source code: https://gitlab.com/chreniuc/hreniuc-dev/-/tree/failed_build
- Public site URL:
- Docusaurus version used: 2.1.0
- Environment name and version (e.g. Chrome 89, Node.js 16.4): v16.15.0
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): Ubuntu 20.04.2 LTS
Self-service
- I’d be willing to fix this bug myself.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Sitemap Error - invalid URLs in seemingly correct xml-file
Sitemap Error - invalid URLs in seemingly correct xml-file. Hi guys,. i uploaded my site and was trying to have it crawled by...
Read more >Fixing Sitemap Errors For Better Indexing of Submitted URLs
If Google fails to process URLs listed on the sitemap index file, you'll get an Invalid URL in sitemap index file error.
Read more >Generating Django sitemap.xml: How to fix 'get_absolute_url ...
By default, location() calls get_absolute_url() on each object and returns the result. you didnot define location() method in your Sitemap class ...
Read more >What to do when your Sitemap status is "Denied URLs"
Make sure the URL root matches ... If you submit your Sitemap using the path https://example.com/sitemap.xml , then the URLs in your Sitemap...
Read more >Sitemap errors reference - Webmaster. Help - Yandex
Error, Description ... The specified tag should not occur in the given context. Tag not found ... Incorrect URL (doesn't match the Sitemap...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
🤪 hard to understand but I figured it out:
I guess the config value you provide is fine and we should instead ensure that our normalization process will always normalize it to add the missing
https://
protocolAnyone want to contribute this?
(please directly submit a PR on your own if you want, don’t ask if you can contribute and then go silent)
Yeah, it’s always a good idea to at least give a heads-up—especially since it’s October😅