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

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

维护者通常 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

  1. Child app on rc.22 with the scaffolded api/src/index.ts secrets schema (only API_DATABASE_URL plus child-specific secrets).
  2. bos upgrade → rc.23 reconciles api/plugin.dev.ts (now passes BETTER_AUTH_SECRET: devAuthSecret).
  3. pnpm run typecheck → TS2353 at plugin.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

主要语言
TypeScript
星标
5
派生
3
平均合并
11 小时 58 分钟
30 天内合并 PR
168

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

NEARBuilders/everything-dev 的其他 Issue

查看 NEARBuilders/everything-dev 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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