ECONNREFUSED when using the `encodeURI` function

I’m using the HTTP node to fetch an image from an S3 system. To prevent issues with accents in filenames, spaces, etc. I’m using the encodeURI or encodeURIComponent function. The issue is that when I’m using either these functions on my URL field expression, I get the following error:

Whereas when I’m not using these functions, the error does not happen?

Any idea?

Error happens on docker and npm versions.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Opened an issue @ ECONNREFUSED when using the `encodeURI` function in the HTTP node. · Issue #7835 · n8n-io/n8n · GitHub

encodeURIComponent wouldn’t work, as that would simply return a string that’s not a valid url.

However encodeURI seems to work as expected for me.

As explained in my OP, both encodeURI and encodeURIComponent do not work. The functions themselves work properly, but using the resulting encoded value renders into an error on the side of the HTTP node.

Can you please share a simple workflow where you can reproduce this issue with encodeURI? I’m unfortunately not able to reproduce this.

encodeURIComponent will not work for this, as it’s not meant to be used to encode entire urls.
The only time one should use encodeURIComponent on a url is if that url is supposed to be a part of query-params of another url, or in form-data.

Going back on my words, the issue doesn’t come from n8n. The minio I’m fetching files from was not giving a verbose enough error so I thought it came from the node.

The issue was with commas in filenames and my workflow not processing correctly the URL passed into the HTTP node.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.