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.

NodeError: Request path contains unescaped characters

See original GitHub issue

Forgive me if this has already been brought up, but I couldn’t find any previous issue about it.

Try going to example.com and opening up the console and running this:

await fetch("http://example.com?foo=网").then(r => r.text());

No error, all is well.

Now check out this runkit example.

Here’s the error:

NodeError: Request path contains unescaped characters
at new ClientRequest in core _http_client.js — line 114
at http.get in core http.js — line 41
 in node-fetch/lib/index.js — line 1327
at new Promise in core  — line 0
at Object.fetch in node-fetch/lib/index.js — line 1319

I guess the browser spec of fetch automatically escapes characters or something? I’m not sure as I haven’t looking into it. It would be nice if there were consistency here in any case.

EDIT: This error doesn’t occur in Node.js 8.x (only 10.x), so I guess there was a change in the http/https libs or something.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8

github_iconTop GitHub Comments

6reactions
wzhouwzhoucommented, Oct 13, 2018

Greetings,

I never disputed whether v6 is supported or not; v6 retired from active LTS as “maintenance” LTS with v8 labeled as the current “active” LTS version. The matter still stands that, the fact that node v11.x, a version 5 major semver releases ahead of v6, is already available as nightly and has a pending official release date, goes to show how significant the fact that v6 transitioned away from active LTS is, and how important a timely response to this issue is.

~William

3reactions
bitinncommented, Nov 5, 2018

I am closing this as a duplicate of #245

For future reader: use require('url').URL to construct a url object and pass it to node-fetch, which will auto escape url for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request path contains unescaped characters, how can I fix ...
Your "path" variable contains space. path: ' /users/'+ username +'/repos', ... In my case, the data included unescaped characters such as '…
Read more >
TypeError: Request path contains unescaped characters
TypeError: Request path contains unescaped characters I have searched for similar issues but have not found anything too similar to this.
Read more >
Request path contains unescaped characters 해결
TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters at new NodeError (node:internal/errors:371:5) at new ...
Read more >
Deploy failed - Request path contains unescaped characters
I'm now getting a deploy failed while trying to build my site. “Request path contains unescaped characters”. My thinking is that some slug ......
Read more >
APA Dictionary of Psychology
... Request path contains unescaped characters"," at new NodeError ... at new ClientRequest (_http_client.js:155:13)"," at request (http.js:94:10)"," at ...
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