SupabaseS
Supabase12mo ago
tom

Postgres User

I’m working on a project where I want to avoid using the Supabase master key for security reasons. Instead, I created a dedicated database user with limited permissions to manage specific operations, such as interacting with a subscription management table. My goal is to ensure secure access while adhering to the principle of least privilege.

Here’s what I’ve done so far:
  1. Created a new database user with limited permissions.
  2. Granted necessary privileges on specific tables and sequences for this user.
  3. Verified the connection using a Postgres client (psql), and the connection works without issues. For example, I’m able to run queries like SELECT * FROM table_name WHERE id = 1 directly in psql.
  4. Configured my backend (using Dart and Dart Frog) to connect to the database with this user’s credentials.
final connection = await Connection.open(Endpoint(
  host: 'aws-0-us-west-1.pooler.supabase.com',
  port: 5432,
  database: 'postgres',
  username: '<LIMITED_USER>',
  password: '<USER_PASSWORD>',
));


However, when I attempt to execute queries from my backend, I consistently encounter the following error:
Severity.fatal XX000: Tenant or user not found
Was this page helpful?