chore(core): Log failed webhook requests with debug (no-changelog) (#12599)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions

This commit is contained in:
Tomi Turtiainen 2025-01-14 15:47:53 +02:00 committed by GitHub
parent c2569a0607
commit a0b7cac3a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,7 @@
import { Container } from '@n8n/di';
import type express from 'express'; import type express from 'express';
import type { IHttpRequestMethods } from 'n8n-workflow'; import { Logger } from 'n8n-core';
import { ensureError, type IHttpRequestMethods } from 'n8n-workflow';
import * as ResponseHelper from '@/response-helper'; import * as ResponseHelper from '@/response-helper';
import type { import type {
@ -52,8 +54,14 @@ class WebhookRequestHandler {
response.headers, response.headers,
); );
} }
} catch (error) { } catch (e) {
return ResponseHelper.sendErrorResponse(res, error as Error); const error = ensureError(e);
Container.get(Logger).debug(
`Error in handling webhook request ${req.method} ${req.path}: ${error.message}`,
{ stacktrace: error.stack },
);
return ResponseHelper.sendErrorResponse(res, error);
} }
} }