Skip to content

Prepare DB Connection URL

When setting up Edge Worker with a database password containing special characters, you must URL-encode these characters to avoid authentication errors like:

Error: SASL_SIGNATURE_MISMATCH: The server did not return the correct signature

Common Characters That Need Encoding

Check if your password contains any of these characters that require encoding:

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

Full list at MDN Web Docs

Quick Guide

1. Encode Your Password

Special characters (@, &, :, etc.) in passwords must be percent-encoded to be correctly interpreted in connection strings.

Use one of these methods:

// JavaScript
const encodedPassword = encodeURIComponent("my@complex&password!");
// Result: "my%40complex%26password%21"
# Python
import urllib.parse
encoded_password = urllib.parse.quote("my@complex&password!")
# Result: "my%40complex%26password%21"
Terminal window
# Linux (requires jq)
encoded_password=$(printf %s "my@complex&password!" | jq -sRr @uri)
# Result: "my%40complex%26password%21"

2. Construct Your Connection String

postgresql://username:ENCODED_PASSWORD@host:port/database

Example:

postgresql://postgres.pooler-dev:my%40complex%26password%[email protected]:6543/postgres

3. Add to Environment

Local development:

supabase/functions/.env
EDGE_WORKER_DB_URL="postgresql://postgres.pooler-dev:my%40complex%26password%[email protected]:6543/postgres"

Deployment:

Terminal window
npx supabase secrets set EDGE_WORKER_DB_URL="postgresql://postgres:my%40complex%26password%[email protected]:5432/postgres"

Security Considerations