How to Configure n8n Supabase Connect

Published
Length
3 min read

Luis Felipe Dias

All posts

To set up an n8n supabase connect workflow, attach a Postgres tool sub-node to your agent. Then, log in using a dedicated database user role instead of the default admin role. Teams often set up these workflows by pasting the main project password into the node. That habit gives every automated step and AI agent broad admin power over your data. When a workflow uses an admin role, one bad query can drop tables or expose rows. How the native n8n supabase connect setup works In n8n, the AI Agen

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

To set up an n8n supabase connect workflow, attach a Postgres tool sub-node to your agent. Then, log in using a dedicated database user role instead of the default admin role. Teams often set up these workflows by pasting the main project password into the node. That habit gives every automated step and AI agent broad admin power over your data. When a workflow uses an admin role, one bad query can drop tables or expose rows.

How the native n8n supabase connect setup works

In n8n, the AI Agent node pairs a chat model with one or more tool sub-nodes. The agent reads the user prompt and decides which tool to call to finish the task. You must attach at least one tool sub-node to an AI Agent node for it to run. From n8n 1.82.0 onward, the old agent type setting is deprecated. Every AI Agent node now runs as a Tools Agent by default. Node version 1, which still has the agent type setting, is removed in n8n 3.0. For database tasks, n8n docs say to pair a Postgres tool sub-node with a recent Agent node. This setup replaces the older SQL Agent mode, which converts plain text into SQL queries.

On the database side, every Supabase project starts with a default postgres role. This default role has admin power across the project. Supabase does not grant full superuser status because superusers can run destructive system commands. Instead, the platform gives the postgres role extra rights for common admin tasks. The password you pick when you create a project belongs to this default postgres role. Queries that you run inside the Supabase Dashboard also run as this postgres role.

Why you should create a dedicated role for n8n

Supabase advises that you should never give the main postgres password to an outside service. Instead, the docs recommends that you create a brand new database user for every service. When you build an n8n workflow, you should make a dedicated role just for n8n. You can then grant that role read or write access to only the tables it needs. If a workflow only needs to look up orders, its role should only read orders.

Supabase also creates built-in roles like anon for public requests, plus authenticated and service_role. If your n8n workflow talks to the database through HTTP requests, it uses those API roles. You can also attach an HTTP Request Tool, a Custom Code Tool, or an MCP server. When you use a direct Postgres tool sub-node, a custom SQL user is the cleanest path. A custom user keeps your main project password out of third-party credential stores.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native roles solve and what they leave open

Creating a separate database user for n8n solves the problem of total admin exposure. It stops an agent or workflow from changing schemas or reading tables outside its scope. Database roles decide who can log in and which tables that user can touch. Still, static roles do not inspect what individual SQL statements do in flight. Once the Postgres tool sub-node logs in, the database trusts every query that role sends.

An AI agent picks its own tools and builds its own queries from user prompts. If a prompt tricks the agent, the agent might pull every row from an allowed table. That query could return sensitive fields like emails, phone numbers, card numbers, or national IDs. Native role grants cannot rewrite those matched fields in query results before the model reads them. They also cannot pause a risky update command to ask a human for approval first. Static credentials stored inside n8n stay valid until an engineer rotates them by hand.

Check every Postgres query on the wire

Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres. It runs beside your database and reads the Postgres wire protocol. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.

Before a query runs, hoop.dev guardrails check the statement by its effect, table, or pattern. They refuse bad deletes or drops with a real Postgres error. On the way back, hoop.dev data masking rewrites sensitive values in returned rows based on your rules. Every query and verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.

Frequently asked questions

Should I use the n8n SQL Agent or a Postgres tool sub-node?

Use a Postgres tool sub-node attached to a recent AI Agent node. From n8n 1.82.0, all AI Agent nodes work as a Tools Agent, and node version 1 is removed in 3.0.

Can I use my main Supabase project password in n8n?

You should not use the main project password because it belongs to the admin postgres role. Supabase recommends creating a separate database user for each third-party service you use.

Does the default Supabase postgres role have superuser rights?

No, Supabase does not give out superuser rights because they allow destructive database actions. The default postgres role is an admin role with extra privileges for supported tasks.

The query runs. The emails stay hidden.