Skip to main content

Error handling system with PostgreSQL logging and rate-limited notifications

Workflow preview

Workflow preview
100%
Error handling system with PostgreSQL logging and rate-limited notifications preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Log errors and avoid sending too many emails Use case Most of the time, it’s necessary to log all errors that occur. However, in some cases, a scheduled task or service consuming excessive resource...

Best for

  • DevOps automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.errortrigger, n8n-nodes-base.postgres, n8n-nodes-base.stickynote, n8n-nodes-base.emailsend, n8n-nodes-base.pushover, n8n-nodes-base.manualtrigger, n8n-nodes-base.executeworkflow, n8n-nodes-base.executeworkflowtrigger

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Davi Saranszky Mesquita.

Original n8n.io source

1.1 Workflow description

Title
Error handling system with PostgreSQL logging and rate-limited notifications
Workflow name
Error handling system with PostgreSQL logging and rate-limited notifications

Log errors and avoid sending too many emails

Use case

Most of the time, it’s necessary to log all errors that occur. However, in some cases, a scheduled task or service consuming excessive resources might trigger a surge of errors.

To address this, we can log all errors but limit alerts to a maximum of one notification every 5 minutes.

What this workflow does

This workflow can be configured to receive error events, or you can integrate it before your own error-handling logic.

If used as the primary error handler, note that this flow will only add a database log entry and take no further action. You’ll need to add your own alerts (e.g., email or push notifications). Below is an example of a notification setup I prefer to use.

At the end, there’s an error cleanup option. This feature is particularly useful in development environments.

If you already have an error-handling workflow, you can call this one as a sub-workflow. Its final steps include cleanup logic to reset the execution state and terminate the workflow.

Setup

Verify all Postgres nodes and credentials when using the 'Error Handling Sample'

How to adjust it to your needs

  1. You can set this workflow as a sub-workflow within your existing error-handling setup.

  2. Alternatively, you can add the "Error Handling Sample" at the end of this workflow, which sends email and push notifications.

Configuration Requirements:

⚠️ You must create a database table for this to work!

DDL of this sample:

create table p1gq6ljdsam3x1m."N8Err" ( id serial primary key, created_at timestamp, updated_at timestamp, created_by varchar, updated_by varchar, nc_order numeric, title text, "URL" text, "Stack" text, json json, "Message" text, "LastNode" text );

alter table p1gq6ljdsam3x1m."N8Err" owner to postgres;

create index "N8Err_order_idx" on p1gq6ljdsam3x1m."N8Err" (nc_order);

by Davi Saranszky Mesquita https://www.linkedin.com/in/mesquitadavi/

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Error Trigger

Type / Role
n8n-nodes-base.errorTrigger - errorTrigger
Config choices
Version 1

Block 2 - Insert Log

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 3 - Count for 5 minutes

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 4 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Principal E-Mail

Type / Role
n8n-nodes-base.emailSend - emailSend
Config choices
Version 2.1

Block 6 - Fallback E-Mail

Type / Role
n8n-nodes-base.emailSend - emailSend
Config choices
Version 2.1

Block 7 - Push mobile notification

Type / Role
n8n-nodes-base.pushover - pushover
Config choices
Version 1

Block 8 - Truncate Log Database

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 9 - Sometimes... just cleanup

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 10 - Call this Sample - Prepend to your error catcher

Type / Role
n8n-nodes-base.executeWorkflow - executeWorkflow
Config choices
Version 1.2

Block 11 - See below to prepend this at your error handling

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 12 - If there is no logs in 5 minutes

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - CleanUp execution. See below if you will prepend this workflow

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Insert your error handling logic after this

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 15 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Error handling system with PostgreSQL logging and rate-limited notifications
Complexity advanced
Nodes 16
Categories DevOps
Author Davi Saranszky Mesquita
Published 05 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3882/3882.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Error handling system with PostgreSQL logging and rate-limited notifications do?

Log errors and avoid sending too many emails Use case Most of the time, it’s necessary to log all errors that occur. However, in some cases, a scheduled task or service consuming excessive resource...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.