N8n giving error in API, and postman working fine, can’t understand it

I’m trying to understand this issue.

This API call works normally in Postman, but when I make an HTTP request in n8n, I get this error, even with the same curl:

Http Request N8n Error:

Postman:

Curl do Postman:
curl --location ‘https://pi.ai/api/chat
–header ‘method: POST’
–header ‘Accept: text/event-stream’
–header ‘Accept-Encoding: gzip, deflate, br, zstd’
–header ‘Accept-Language: en-US;q=0.9,en;q=0.8’
–header ‘Referer: https://pi.ai/discover
–header ‘Origin: https://pi.ai
–header ‘Content-Type: application/json’
–header ‘X-Api-Version: 3’
–header ‘Cookie: __Host-session=iwJrHTN4CFyx4CdVWNs5w; __cf_bm=qsMcQHMkZCuLey2H4bGBo4RWxvtjPCRWleMW3MU2L.c-1725027757-1.0.1.1-OWlyohnYGBeXHhx6.Qt1k4o7G5V09.JyGHgdZTQNctwvPZsxyf7f0KBQAshQ9P12NtggZmqyf35x1lB1ZCleqg; __Host-session=iwJrHTN4CFyx4CdVWNs5w; __cf_bm=cK.JN.b1tRlYDrmH8pIqeUt4Myo5Yn_3mtv8IIqNlRI-1725217534-1.0.1.1-1ZJau5bAvUZ33cDyMbvEXgRwoxXRH9qF8OAyA6p_6JEgYhyFBH8F9k0sUGRcPwynUv2plt8s155Lml7E8ZbT7g’
–data ‘{
“text”: “cual api do pi.ai”,
“conversation”: “sZy322np39XiRivba1zo5”
}’

Information on your n8n setup

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

@Phelippe_Michel , I’m afraid it cannot work in n8n. The HTTP request you are trying to replicate is so-called Server-Sent Events (SSE) request. Browsers support this technology. Postman is built on Chromium engine. It is essentially a browser-based application. n8n on the other hand is built on a different technology, it is a node.js application.

Server-Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server via an HTTP connection, and describes how servers can initiate data transmission towards clients once an initial client connection has been established. They are commonly used to send message updates or continuous data streams to a browser client and designed to enhance native, cross-browser streaming through a JavaScript API called EventSource, through which a client requests a particular URL in order to receive an event stream.

As your Postman screenshot demonstrates, a single initiation request resulted in a serious of responses from the server (Pi.ai API) - a few stream events pushed back to the client.

HTTP Request node only supports the standard HTTP methods.

1 Like

I understand. Thank you for clarifying my doubts

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