HTTP node - Response Format JSON ➝ response with empty body ➝ no output

Describe the issue/error/question

Hello,

the majority of APIs I’m working with n8n returns error descriptions as buffer representation. In order to see the error description, in the HTTP node I set ‘Response Format’ to JSON.

But there’s an issue with setting the JSON Response Format.

Some endpoints return an empty response body. Without the ‘Response Format’ option specified the HTTP node returns an empty item. With ‘Response Format’ set to JSON, the HTTP node doesn’t return output, even if the option ‘Always Output Data’ is turned on (which is logical I guess, since technically, there is an output).

Would it be possible for n8n to return an empty body as an empty item in such cases? I can turn on the ‘Include Response Headers and Status’ option but there’s a lot of data in Headers I don’t need which makes my workflow slower.

What is the error message (if any)?

Please share the workflow

To mock the empty response body I’ve used a dummy API endpoint and OPTIONS method. The ‘Response Format’ is set to JSON.

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 0.205.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hey @antitalent,

That sounds like we need to work on the error handling for the HTTP Request node so it correctly shows the error I think that would solve your issue. I will get a dev ticket raised for that now.

Hi @Jon, thank you. Yes, it definitely would. The JSON Response Format works pretty well though (meaning the response schema is ok and error descriptions are shown) except for edge cases with no response body, just response code. I thought this would be a quicker fix (output empty items in such cases) than fixing the error handling (just my guess).

Hello @antitalent, do you still getting this error? I did try reproduce it using your workflow, but result is empty response.

Hi @Michael_Kret, the workflow was just an example of getting the empty response where you should get the empty item in my opinion.

As far as error messages are concerned, I think there’s been some progress. I don’t see buffer representation but a stringified JSON - not ideal, but better.

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