GitLab Trigger checkExists can mishandle 404 and crash on missing error description
Bug Description
The GitLab Trigger's webhook checkExists handler reads error.cause.httpCode when the GitLab API returns a 404. gitlabApiRequest wraps request failures as NodeApiError, whose resolved status is available on error.httpCode. The fallback then calls error.description.includes('404') without checking whether description exists. A missing webhook can therefore be handled as an unrelated exception rather than returning false and clearing the stale webhook ID; an error without a description can instead throw a TypeError while handling the original error.
To Reproduce
- Configure a GitLab Trigger with a stored webhook ID.
- Have its GET
/projects/{project}/hooks/{id}request reject with aNodeApiErrorwhosehttpCodeis'404'and whose description is empty or absent. - Invoke
webhookMethods.default.checkExists. The existingerror.cause.httpCode/error.description.includes(...)path does not reliably recognize the 404. The regression tests in PR #35486 exercise this handler directly.
Expected behavior
A 404 should clear the stale webhook ID/events/secret and return false so the webhook can be recreated. Non-404 errors should propagate unchanged, including errors without a description.
This report is for the error-handling branch of checkExists, not the unrelated DELETE failure discussed in #4217. Fix and regression tests: #35486.
Source: n8n-io/n8n