콘텐츠로 이동

오류 처리#

흐름 로직을 설계할 때 잠재적인 오류를 고려하고 이를 정상적으로 처리하는 방법을 설정하는 것이 좋습니다. 오류 워크플로우를 사용하면 n8n이 워크플로우 실행 실패에 응답하는 방식을 제어할 수 있습니다.

오류 조사

실패한 실행을 조사하려면 다음을 수행할 수 있습니다.

오류 워크플로우 생성 및 설정#

각 워크플로우에 대해 워크플로우 설정에서 오류 워크플로우를 설정할 수 있습니다. 실행이 실패하면 실행됩니다. 즉, 예를 들어 워크플로우 실행 오류 시 이메일 또는 Slack 알림을 보낼 수 있습니다. 오류 워크플로우는 오류 트리거로 시작해야 합니다.

여러 워크플로우에 동일한 오류 워크플로우를 사용할 수 있습니다.

  1. Create a new workflow, with the Error Trigger as the first node.
  2. Give the workflow a name, for example Error Handler.
  3. Select Save.
  4. In the workflow where you want to use this error workflow:
    1. Select Options Options menu icon > Settings.
    2. In Error workflow, select the workflow you just created. For example, if you used the name Error Handler, select Error handler.
    3. Select Save. Now, when this workflow errors, the related error workflow runs.

오류 데이터#

The default error data received by the Error Trigger is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
[
	{
		"execution": {
			"id": "231",
			"url": "https://n8n.example.com/execution/231",
			"retryOf": "34",
			"error": {
				"message": "Example Error Message",
				"stack": "Stacktrace"
			},
			"lastNodeExecuted": "Node With Error",
			"mode": "manual"
		},
		"workflow": {
			"id": "1",
			"name": "Example Workflow"
		}
	}
]

All information is always present, except:

  • execution.id: requires the execution to be saved in the database. Not present if the error is in the trigger node of the main workflow, as the workflow doesn't execute.
  • execution.url: requires the execution to be saved in the database. Not present if the error is in the trigger node of the main workflow, as the workflow doesn't execute.
  • execution.retryOf: only present when the execution is a retry of a failed execution.

If the error is caused by the trigger node of the main workflow, rather than a later stage, the data sent to the error workflow is different. There's less information in execution{} and more in trigger{}:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
  "trigger": {
    "error": {
      "context": {},
      "name": "WorkflowActivationError",
      "cause": {
        "message": "",
        "stack": ""
      },
      "timestamp": 1654609328787,
      "message": "",
      "node": {
        . . . 
      }
    },
    "mode": "trigger"
  },
  "workflow": {
    "id": "",
    "name": ""
  }
}

중지 및 오류를 사용하여 워크플로우 실행 실패 유발#

오류 워크플로우를 생성하고 설정하면 실행이 실패할 때 n8n이 실행합니다. 일반적으로 이는 노드 설정 오류 또는 워크플로우 메모리 부족과 같은 문제 때문입니다.

중지 및 오류 노드를 워크플로우에 추가하여 선택한 상황에서 실행이 강제로 실패하도록 하고 오류 워크플로우를 트리거할 수 있습니다.