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:
Character | Encoding | Character | Encoding |
---|---|---|---|
@ | %40 | & | %26 |
: | %3A | / | %2F |
? | %3F | # | %23 |
% | %25 | (space) | %20 |
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:
// JavaScriptconst encodedPassword = encodeURIComponent("my@complex&password!");// Result: "my%40complex%26password%21"
# Pythonimport urllib.parseencoded_password = urllib.parse.quote("my@complex&password!")# Result: "my%40complex%26password%21"
# 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:
EDGE_WORKER_DB_URL="postgresql://postgres.pooler-dev:my%40complex%26password%[email protected]:6543/postgres"
Deployment:
npx supabase secrets set EDGE_WORKER_DB_URL="postgresql://postgres:my%40complex%26password%[email protected]:5432/postgres"