asyncpg icon indicating copy to clipboard operation
asyncpg copied to clipboard

Connect with passwordless DSN does not work

Open andreas-esders-kopecky opened this issue 1 month ago • 0 comments

Basically as the title says: Trying to connect with a DSN that contains no password does not work

DSN in question:

@property def dsn(self) -> str: return f"postgresql+asyncpg://{self.pguser}@{self.pghost}:{self.pgport}/{self.pgdatabase}"

results, when used with

` def get_db_url() -> str: config = get_config() return config.postgres.dsn

engine = create_async_engine( get_db_url(), echo=True, future=True, ) `

in the error:

ERROR: Traceback (most recent call last): File "asyncpg/protocol/coreproto.pyx", line 168, in asyncpg.protocol.protocol.CoreProtocol._process__auth File "asyncpg/protocol/coreproto.pyx", line 577, in asyncpg.protocol.protocol.CoreProtocol._parse_msg_authentication File "asyncpg/protocol/coreproto.pyx", line 672, in asyncpg.protocol.protocol.CoreProtocol._auth_password_message_cleartext AttributeError: 'NoneType' object has no attribute 'encode'

andreas-esders-kopecky avatar Nov 13 '25 14:11 andreas-esders-kopecky