Skip to content

Connection String Encoding

If your database password contains special characters, you must URL-encode them to avoid authentication errors like:

Error: SASL_SIGNATURE_MISMATCH: The server did not return the correct signature
Error: password authentication failed for user

Before encoding, get your connection string from Supabase:

  1. Open Supabase Dashboard
  2. Navigate to SettingsDatabase
  3. Scroll to Connection String section
  4. Copy the Transaction Mode connection string (port 6543)

The string looks like:

postgresql://postgres.pooler-yourproject:[YOUR-PASSWORD]@aws-0-us-east-1.pooler.supabase.com:6543/postgres

Replace [YOUR-PASSWORD] with your actual database password from the dashboard (you may need to reveal it first).

Check if your password contains any of these characters:

CharacterEncodingCharacterEncoding
@%40&%26
:%3A/%2F
?%3F#%23
%%25 (space)%20
!%21=%3D

Full encoding reference at MDN Web Docs

Use the code examples below to encode your password on your own machine. These methods allow you to encode your credentials locally without sharing them with third-party services.

const encodedPassword = encodeURIComponent("my@complex&password!");
console.log(encodedPassword);
// Output: my%40complex%26password%21

Here’s a realistic example showing the full process:

Original password from Supabase Dashboard:

P@ssw0rd!2024

Encode just the password:

P%40ssw0rd%212024

Original connection string:

postgresql://postgres.pooler-yourproject:P@[email protected]:6543/postgres

Encoded connection string:

postgresql://postgres.pooler-yourproject:P%40ssw0rd%[email protected]:6543/postgres

Use the encoded connection string to set your database secret:

npx supabase secrets set EDGE_WORKER_DB_URL="postgresql://postgres.pooler-yourproject:P%40ssw0rd%[email protected]:6543/postgres"

Replace the hostname, project name, and encoded password with your actual values.

Test your connection by deploying and starting your worker:

npx supabase functions deploy your-worker-name
curl "https://your-project.supabase.co/functions/v1/your-worker-name" \
-H "Authorization: Bearer YOUR_ANON_KEY"

If you see worker logs without authentication errors, the encoding worked.

For full deployment instructions, see Deploy Your First Flow.