Webhook - handle Authorization failure

Hey

TL;DR;
Is there a way to catch and action on an Authorization Error in the webhook node?

Longer version:
I have a Webhook node set up in a workflow (as the starting point), and have Header Auth set up on the Webhook.

If the webhook is called with incorrect Auth, it returns 401 Authorization data is wrong! (which is as expected), however I would like my Workflow to report on this - for example, an email node to send me an email saying “Hey, this Webhook was called, incorrectly”.

Is this possible?

I have an error handler workflow set up, but it doesn’t seem to be triggered by a failed Auth on the webhook.

Thanks in advance,
Rob

  • n8n version: latest
  • Database - default: SQLite):
  • Running n8n via Docker (self-hosted)
  • Operating system: Ubuntu 22.04

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 @runriot! Thanks for reaching out!

You could handle it similar to the solution offered in this thread wherein you continue on fail through the webhook call and conditionally output details about the response: Webhook Error in workflow details - #4 by MutedJam

Thanks - that looks like it’d work, but I don’t see the “Continue on Fail” option on the Webhook node…

Options offered are:
options

And webhook node settings are:
settings

NB I noticed it’s Webhook node v1 as oppose to v2, but just tested a v2 node and the options are no different.

Am I missing something?

Thanks

@runriot There was an assumption on my part that you were calling the webhook from another workflow. Is that the case? Or are you calling it from an external service?

You are correct that the webhook node itself does not have that option, but the HTTP Request node does if you use that to call the webhook.

Hey

I’m calling the n8n webhook from an external service.

Thinking about it… The webhook endpoint will most likely just return the 401 state at the header, and then cease - ie not even being able to proceed for the node to pick up the request - so it’s likely impossible to catch it within n8n?

Makes more sense to catch it at the external service end (but in this case, it has no ability to do so, hence this question!)

1 Like

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