MagicStack / MagicStack/asyncpg

Connect with passwordless DSN does not work

未关闭
#1,286 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
8.1k
派生
468
PR 合并指标
30 天内没有已合并 PR

描述

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'
`

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用所示的无密码 PostgreSQL DSN 和 create_async_engine 入口点重现该故障。跟踪所报告的 traceback _auth_password_message_cleartext 附近的密码认证路径;当无密码连接不再引发 NoneType encode error,且此情况有测试覆盖时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
postgresql, python, sqlalchemy
领域
databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。