rc.23 template bug: api/plugin.dev.ts passes BETTER_AUTH_SECRET but template api/src/index.ts doesn't declare it — child typecheck fails after upgrade
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 77/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- backend
调研方向
阅读 .github/templates/api/src/index.ts,并将其 secrets schema 与 api/src/index.ts 以及由 api/plugin.dev.ts 传入的 BETTER_AUTH_SECRET 进行比较。将缺失的声明添加到模板中,使其符合 issue 中描述的 framework schema。确认子 scaffold 的类型检查能够通过 framework 管理的 plugin 配置。
由索引模型根据 Issue 内容生成。
描述
Summary
Upgrading a child app to platform 2.0.0-rc.23 (bos upgrade) reconciles the framework-owned api/plugin.dev.ts, which now passes BETTER_AUTH_SECRET into the api plugin's dev secrets:
secrets: {
API_DATABASE_URL: process.env.API_DATABASE_URL || "pglite:.bos/api/:memory:",
BETTER_AUTH_SECRET: devAuthSecret,
},
But the scaffold template the child's api plugin is built from (.github/templates/api/src/index.ts) only declares API_DATABASE_URL in its secrets schema. The child's satisfies PluginConfigInput<typeof Plugin> then fails:
plugin.dev.ts(30,7): error TS2353: Object literal may only specify known properties, and 'BETTER_AUTH_SECRET' does not exist in type '{ API_DATABASE_URL?: ... }'
The framework's own api plugin (api/src/index.ts at rc.23) declares the secret correctly:
BETTER_AUTH_SECRET: z.string().describe("Platform root secret — the secrets vault derives each runtime's KEK from it (HKDF, runtime-scoped salt)."),
So the template pair is internally inconsistent, and every child upgraded to rc.23 that keeps the scaffold's secrets schema fails CI typecheck until it hand-adds the secret.
Repro
- Child app on rc.22 with the scaffolded
api/src/index.tssecrets schema (onlyAPI_DATABASE_URLplus child-specific secrets). bos upgrade→ rc.23 reconcilesapi/plugin.dev.ts(now passesBETTER_AUTH_SECRET: devAuthSecret).pnpm run typecheck→ TS2353 atplugin.dev.ts(30,7).
Seen in https://github.com/NEARBuilders/feedback.nearbuilders.org/actions/runs/40236580619
Suggested fix
Update .github/templates/api/src/index.ts to declare BETTER_AUTH_SECRET in the secrets schema, matching the framework's own api plugin (required z.string() with the KEK describe text), so the scaffold typechecks against the framework-owned plugin.dev.ts out of the box.
Alternatively, if children aren't meant to declare it, plugin.dev.ts shouldn't pass it — but given the real api plugin consumes it for the secrets vault, declaring it in the scaffold seems right.
Context
- Framework version:
2.0.0-rc.23 - Child workaround applied in https://github.com/NEARBuilders/feedback.nearbuilders.org (add the secret to the child's secrets schema +
bos.app.tsapi.secrets)
- 主要语言
- TypeScript
- 星标
- 5
- 派生
- 3
- 平均合并
- 11 小时 58 分钟
- 30 天内合并 PR
- 168
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NEARBuilders/everything-dev 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
NEARBuilders/everything-dev#696 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
NEARBuilders/everything-dev#686 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
NEARBuilders/everything-dev#678 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
NEARBuilders/everything-dev#400 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
NEARBuilders/everything-dev#685 ·
维护者通常 1 天内回复
查看 NEARBuilders/everything-dev 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 74/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
remotion-dev/remotion#12905 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
supermomonga/paseo-plugin-zcode-provider#83 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
oxidecomputer/skepsis#102 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
voidzero-dev/void#677 ·
维护者通常 1 天内回复