Http node Error : JSON response

Hi there,

It seems i’ve the same issue as described here : HTTP node - Response Format JSON ➝ response with empty body ➝ no output - #5 by antitalent

When an HTTP node get an Error, the error message is unusable, it is not the error message my API is sending. It’s come with a lot of “axios things” and i cant parse message error.

"error": 
{
"message": 
"400 - "{\"errorCode\":400,\"message\":\"WRONG_SEALINE\",\"details\":[\"Invalid carrier alpha code (SCAC) specified\"],\"time\":\"2024-02-22T15:12:24.286266028Z\"}"",
"name": 
"AxiosError",

Is there a way to just get the error my API is sending instead of all this axios syntax ?

I use the “continue (using error output)” option because i need to send the error to my front end (webhook/respond to webhook dynamics)

Thanks :slight_smile:

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:

Hey @dubarseo,

The error from the API is in the message so in theory you could use error.message and remove the status code then convert the rest to json.

1 Like

Thanks for your help :slight_smile:
How to remove status code and convert the rest to JSON ?

Hey @dubarseo,

Quickest I can think of would be a replace or slice to remove the first part then use the JSON.parse() javascript method.

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