From edbc5bb59ae837ef7268ee712fd215058f176535 Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Wed, 3 Jan 2024 20:43:31 +0200 Subject: [PATCH] fix(core): Unsafe isAxiosError property access (no-changelog) (#8197) ## Summary in some cases the actual error does not get returned. It is apparently reproducible with the OpenAI node but will probably also be a bug and so a problem in other nodes: https://community.n8n.io/t/problem-in-node-openai-cannot-read-properties-of-undefined-reading-isaxioserror/34716/9 ## Related tickets and issues https://linear.app/n8n/issue/NODE-1028/actual-error-does-not-always-get-returned ## Review / Merge checklist - [ ] PR title and summary are descriptive. **Remember, the title automatically goes into the changelog. Use `(no-changelog)` otherwise.** ([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md)) - [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up ticket created. - [ ] Tests included. > A bug is not considered fixed, unless a test is added to prevent it from happening again. > A feature is not complete without tests. --- packages/workflow/src/RoutingNode.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/workflow/src/RoutingNode.ts b/packages/workflow/src/RoutingNode.ts index f33382bb3..0a635d06b 100644 --- a/packages/workflow/src/RoutingNode.ts +++ b/packages/workflow/src/RoutingNode.ts @@ -235,7 +235,7 @@ export class RoutingNode { let routingError = error as AxiosError; - if (error instanceof NodeApiError) routingError = error.cause as AxiosError; + if (error instanceof NodeApiError && error.cause) routingError = error.cause as AxiosError; throw new NodeApiError(this.node, error as JsonObject, { runIndex,