Describe the issue/error/question
So if the workflow errors I have an error trigger that sends me a message to slack, but I would also like to send a message back to the user that something might be wrong with the data they sent to the webhook. My problem is how do I dynamically and properly use the Stop and Error node to give them something like a status code 400 and the error message from the flow that errored not just a static error message?
Error notification workflow
I’ve also tried this way but I get
ERROR: Invalid JSON in 'Response Body' field
Information on your n8n setup
- n8n version: 0.214.3
- Running n8n via [n8n.cloud]:
You should be able to use the error trigger within the workflow it self too. This should in theory allow you to use the respond to webhook node and return the error.
I’m not sure I understand. Something like this? Doing it this way the trigger doesn’t seem to kick off. The problem I’m running into is I really need to get the error sent by the Salesforce nodes. Using continue on fail and checking if their data or not then sending webhook response just isn’t informative enough. Unless there is a way to get the full error. In this error I really need to be able to responed with information that last name can not be blank as sent from Salesforce.
If I could just extract the (Joanne) cannot have blank last name section of the error I could just do checks within my flow and pass respond, but I haven’t figured out a way to grab that part of the error. Only the have been able to get the Bad Request part.
I got the error trigger to run being in the same workflow, but I’m still getting the error Invalid JSON. JSON output is valid per jsonlint at least. I’m still getting just the generic error in workflow message.
You might need to parse it with
I got rid of the Invalid JSON error, but I’m still running into that repsonse body not being returned to the caller. When I call from Postman to the webhook its running the error trigger and it building the webhook response, but I’m still getting the
message: error in workflow back from n8n instead of the response from the error trigger.
I’ve tested it, and you are correct. n8n is doing something I wasn’t expecting.
It now has 2 executions, it does make sense but wasn’t expecting it.
No idea if there is an easy fix.
That is expected behavior. When a workflow has an error it stops. That is also why the node is called “Stop and Error”. The Error Workflow execution is then a totally new one, even if the Error Trigger is in the same workflow. Meaning the only way to send a different response to the webhook, is by making sure the workflow does not fail, by for example activating “Continue on Error”, and then branching off.
One other way if you wan to send a message to slack would be to set a property in the Error (like a callback URL). As far as I know is it also always given by default. If you pass that via the error to the Error Workflow you are then able to send a custom error message as response.
Here a basic and rough example (HTTP Request node is not configured for Slack)
Yeah, it does make sense. Simply wasn’t expecting it when giving a possible solution.
Just curious, would there be a way of having the webhook respond the error in this case? (except for handling errors after each node)
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.