docs: defineBetterAuthService reference never mentions opt-in user.* flags like deleteUser

未关闭 适合新手
#174 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

在仓库中搜索随附的 RelKit 技能,并找到其 data-apis.md 参考文档中的 defineBetterAuthService 部分。了解该示例的维护方式,然后添加简短说明和 user.* 可选启用选项(例如 deleteUser)的示例。完成标准是:参考文档明确说明该选项默认禁用,并展示如何启用。

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

描述

documentation good first issue
Page or file

The bundled RelKit skill's defineBetterAuthService reference. In an installed project it lands at .agents/skills/relkit/references/data-apis.md (section ## defineBetterAuthService); I couldn't find the equivalent path in this monorepo's source, but a repo-wide search for the skill content should find it quickly.

Problem
  • Missing
Details

The entire defineBetterAuthService example in the skill is:

import { defineBetterAuthService } from "@relkit/better-auth";

export default defineBetterAuthService({
  baseURL: process.env.BETTER_AUTH_URL ?? "http://127.0.0.1:3000",
  emailAndPassword: { enabled: true },
});

That's the only config surface the skill shows. It never mentions that Better Auth's user.* options exist or that several of them are opt-in and off by default - deleteUser in particular.

Why this is worth documenting: Better Auth defines POST /api/auth/delete-user unconditionally (its OpenAPI metadata is attached at endpoint-definition time, in better-auth/dist/api/routes/update-user.mjs), so it always shows up in the generated OpenAPI spec / Scalar docs for a RelKit app that scaffolds Better Auth. But the handler body gates on ctx.context.options.user?.deleteUser?.enabled and throws a bare APIError.fromStatus("NOT_FOUND") (empty body, no error code) when that flag isn't set - which it never is unless you explicitly add user: { deleteUser: { enabled: true } } }.

Net effect for anyone following only the skill's example: your app's Scalar docs advertise a working "delete my account" endpoint that 404s with no explanation, and there's nothing in the skill that would lead you to user.deleteUser to notice the gap. I only found the root cause by reading better-auth's source directly.

Suggested fix: extend the defineBetterAuthService reference section to at least name the existence of opt-in user.* feature flags (deleteUser, and similarly email-verification/password-reset's sender callbacks), with a one-line example like:

user: {
  deleteUser: { enabled: true }, // off by default; route 404s until set
},

so an agent/developer scaffolding auth knows these exist and can decide for themself whether to turn them on, rather than discovering it as a silent 404 in production docs.

(Context, not something to fix here: the bare/empty-body 404 on a disabled Better Auth feature is better-auth's own behavior, not RelKit's - flagging only in case it's useful upstream.)


Found while doing an exhaustive route-by-route test pass (151 requests across all 81 OpenAPI endpoints) on an app scaffolded with @relkit/[email protected] / @relkit/[email protected].

主要语言
TypeScript
星标
1
派生
0
平均合并
2 小时 45 分钟
30 天内合并 PR
64

环境准备

从这里开始

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

rel-kit/relkit 的其他 Issue

查看 rel-kit/relkit 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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