question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Invalid URL while trying to build with sitemap not set to false

See original GitHub issue

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I’m using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn 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

Self-service

  • I’d be willing to fix this bug myself.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
slorbercommented, Sep 28, 2022

🤪 hard to understand but I figured it out:

- url: 'hreniuc.dev',
+ url: 'https://hreniuc.dev',

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:// protocol


Anyone 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)

1reaction
Josh-Cenacommented, Oct 2, 2022

Yeah, it’s always a good idea to at least give a heads-up—especially since it’s October😅

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found