-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError [ERR_INVALID_URL]: Invalid URL #8641
Comments
Thank you for taking time to create a minimal repro! That was very helpful. FYI, it succeeds when you add spaces around the URL: 比如在 www.baidu.com 下开启控制台,然后写入Cookie: This is because of how MDX extracts links. You can try this in the MDX playground: You'll see that it parses the link all the way to the end of the line. I don't think there's much we can do on our side. The DX is terrible, so maybe we can throw a better error, or simply skip nodes that contain invalid URLs. |
With MDX 2 the link extraction is moved to the GFM (github flavored markdown) remark plugin. The bug is still reproducible on the MDX 2 playground once the GFM plugin is turned on (in the options tab): Looks like a bug to fix in remark-gfm? cc @wooorm Note, it looks like even GitHub has this bug? so 🤷♂️ |
It's not a bug in remark-gfm, as you show, that's exactly how GH works. Which is the point of remark-gfm! |
Thanks @wooorm 👍 So I guess we can close. Possible solutions, that are all out of the Docusaurus scope:
|
IMO, the DX is quite terrible. The error is thrown from our own link visitor, and, disabling that, the page at least gets rendered and the user will be able to see the incorrect link in deploy preview and know how to fix it. We should make the link visitor not throw on invalid URLs. |
👍 ok to improve the DX on this case. It could also throw a more relevant error message suggesting to use a markdown link? 🤷♂️ |
also get it, while so many md files and no idea to find this url or file, need more error messages |
i am here related to nodejs version
Azure static wep app(Oryx) use node:v18.17.1 npm:9.6.7 will cause this error, at last i config node version. |
i meet the same error, its just print TypeError: Invalid URL
[ERROR] Client bundle compiled with errors therefore further build is impossible. but didnt locate which file (or line) cause this error. |
good lucky 🤝 |
docusaurus: 2.4.1 Ran into the same issue, no changes in the content just moved from node 16.14 to 18.17 and got the error.
Was able to track down more detail by running the development server
In my case the error was triggered by the text |
@wilfred-s we'd need a full md document repro here. If your doc contains sensitive data you can trim if down to a minimal version as long as we can still reproduce the issue. Also it's possible that this is fixed in Docusaurus v3.0 (coming very very soon) |
This is the simplest file I could get it to replicate with, Just one sentence with nothing else in the file really: Full error and stacktrace, taken from the running dev server:
For the full site source code see: https://github.com/apache/yunikorn-site |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I am using Vercel to deploy the Docusaurus site, But report an error when packing online, "TypeError [ERR_INVALID_URL]: Invalid URL", And local packaging will not report this error.
I consulted Vercel’s members, feedback that it is Docusaurus’s problem. They think hardcoding the url in docusaurus is what conflicting the problem? Unfortunately, docusaurus doesn't generate helpful error to give more verbose information.
You can see my history Commit. There is no modification of deployment related configuration, but some can be deployed successfully.I just modified the content of the Markdown file, so I can make the deployment fail or succeed. This looks abnormal.
Reproducible demo
No response
Steps to reproduce
Expected behavior
Local and online packaging is normal
Actual behavior
Local packaging is normal, but Vercel's online packaging fails
Your environment
Self-service
The text was updated successfully, but these errors were encountered: