Telegram ERROR: Bad request - please check your parameters

Describe the problem/error/question

My n8n instance run in a isolated network and I need to use proxy.
I set http_proxy and https_proxy in Docker container and I can see logs in the proxy.
When I use Telegram I got some errors and no idea how to solve it.

What is the error message (if any)?

ERROR: Bad request - please check your parameters
400 The plain HTTP request was sent to HTTPS port 400 Bad Request The plain HTTP request was sent to HTTPS port nginx/1.18.0
NodeApiError: Bad request - please check your parameters
    at Object.apiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Telegram/GenericFunctions.js:82:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Telegram/Telegram.node.js:1677:36)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:652:28)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:53

Please share your workflow

Share the output returned by the last node

The output is the error I paste above.

Information on your n8n setup

  • n8n version: 0.231.3
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not set, use the default settings
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: NixOS

Hi @browse

I suspect you’re setting the wrong Chat ID

Here is a quick overview:

  • Chat ID of the Person starts with number (All Numbers)
  • Chat ID for the Group or Channel starts with - (hypen)

I think you’re setting @username instead of Chat ID.

I might be wrong, Just saying based on the workflow you shared.

@mcnaveen Thanks for you reply.
I’ve also tried NocoDB and it’s the same error.

  • My proxy works fine and was online almost 3 years. It’s was used in various other tools.
  • I deploy n8n in another environment without proxy. It works well.
  • But if n8n+proxy, it crashes.

It’s weird that I can see the request is https in the proxy,but the server respond “400 The plain HTTP request was sent to HTTPS port”.

I need to know what happend between the proxy and the Telegram/NocoDB server.
I should dig deeper with some mitm tools such as mitmproxy or burpsuite.

1 Like

After doing some mitm work, I’ve found the bug.It’s n8n’s fault.

Here is the http request from n8n:

Accept: application/json
xc-token: my_token
User-Agent: axios/0.21.4
Connection: close

The host in the credential is n8n send http request to 443 port?

Hey @browse,

That doesn’t look right to me, Is your https proxy using an https value for https_proxy or http? When I did some testing recently I was using Squid and my env options were…


Has your n8n installation ever worked with your proxy or has it always failed?

Just done a very quick test and in my proxy access log when testing a telegram credential I can see…

1687877459.749 2349 TCP_MISS/200 682 GET[REMOVED]/getMe - HIER_DIRECT/ application/json

The request is also acknowledged in the n8n interface with a successful connection test so it looks like the http_proxy and https_proxy settings are working as expected at the moment.

@Jon My proxy is an http proxy. I set the env like:


So the https_proxy should have a proxy start with https?
I just think it’s like the environment in linux env.

I don’t know how n8n concatenate the request url and how axios use the proxy.
But I think the request url scheme shouldn’t be obtained from the proxy scheme.

Hey @browse,

The underlying issue comes from Axios and they have many issues opened about it…

At the moment the best option is to configure the proxy to have an HTTPS listener.

1 Like

@Jon So it’s axios’s fault. :joy: I’ll subscribe this issue Proxy support does not work properly with CONNECT on https requests · Issue #4531 · axios/axios · GitHub.
Thanks for your help.

1 Like

@browse not really a big fan of the blame game, I believe there could be things we can do to work around this limitation but at the same time the proxy could also be configured for it as well :slight_smile:

Sorry, I mean the origin cause of the bug is from axios.
Thanks for your hard work and patience. :clap:

1 Like

In that case… yes :slight_smile:

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