Skip to content

Auth error: '500: Database error querying schema'

Last edited: 8/12/2026

如果你在认证日志中看到错误信息 500: Database error querying schema,通常意味着 Supabase 认证服务器在 auth.users 表中遇到了 NULL 值,而那里本应该是有效的字符串或空字符串。

🌐 If you observe the error message 500: Database error querying schema in your Auth logs, it typically indicates that the Supabase Auth server has encountered NULL values in the auth.users table where a valid string or empty string is expected.

为什么会这样? 这个问题通常发生在对 auth.users 表进行手动 SQL 插入或更新之后。认证服务期望某些列包含数据或为空字符串;当它遇到 NULL 值时,就会触发验证错误。

如何解决这个问题: 找出包含 NULL 值的列(例如 email),然后在 SQL 编辑器 中执行以下命令,将它们转换为空字符串:

1
UPDATE auth.users
2
SET <column_name> = ''
3
WHERE <column_name> IS NULL;

<column_name> 替换为导致错误的具体列。为了防止这种情况再次发生,确保对 auth 模式的任何未来手动修改都符合服务的要求。

🌐 Replace <column_name> with the specific column causing the error. To prevent this from recurring, ensure that any future manual modifications to the auth schema adhere to the service's requirements.