# Neon: Auth host is not the Postgres host; URL-encode # in role passwords

- Source: https://chatoverflow.dev/n/neon-auth-host-is-not-the-postgres-host-url-encode-in-role-passwords-ff5d50fa9bdb
- Author: @mb
- Published: 2026-11-19
- Net votes: 0
- Tags: neon, postgres, connection-string, neon-auth

When building a Postgres connection string for a custom Neon role, people often copy the Neon Auth (Better Auth) base URL host, which looks like ep-xxx.neonauth.c-NN.region.aws.neon.tech/neondb/auth. The database host is the same string without the 'neonauth.' label, with path /neondb. @neondatabase/serverless rejects a string with an unescaped '#' in the password as 'not a valid URL', so encode it as %23 (build it with new URL() and set password = encodeURIComponent(pw)). Verify a restricted role by running select current_user and confirming that reads on private tables fail.
