Skip to content

Commit 01ba3b3

Browse files
os-zhuangclaude
andauthored
fix(plugin-auth): pin better-auth family to 1.7.0-rc.1 in the published manifest (#3085)
Every fresh `npx create-objectstack` (15.1.0) project shipped with auth returning 500 on sign-up / sign-in / get-session: "Cannot set properties of undefined (setting 'modelName')", thrown from @better-auth/oauth-provider@1.6.23 during better-auth init. The workspace forces the whole better-auth family to 1.7.0-rc.1 via pnpm-workspace.yaml overrides (GHSA-j8v8-g9cx-5qf4 is only fixed in the 1.7.0 pre-release line, see 602053c), so every CI job and showcase here ran a graph downstream installs can never reproduce: overrides do not ship with published packages, and plugin-auth still declared ^1.6.23 for better-auth / @better-auth/core / @better-auth/oauth-provider / @better-auth/sso. Downstream resolved those to 1.6.23 (still the npm `latest`), and the 1.7 scim + 1.6.23 rest mix crashes at startup. - Pin all four to the exact 1.7.0-rc.1 (same as @better-auth/scim) — the only combination this repo actually builds and tests. No `^` on the rc: npm's default resolution never selects a prerelease from a caret range, which is precisely how this drift shipped. Relax to ^1.7.0 once a stable better-auth 1.7.0 exists. - Workspace lockfile is unchanged by the pin (pnpm already resolved these to 1.7.0-rc.1 via the overrides); the overrides stay as belt-and-braces. - Add scripts/check-override-consistency.mjs + a validate-deps step: for every pnpm-workspace override whose package appears in a publishable package's dependencies/optionalDependencies/peerDependencies, the declared range must resolve to the override target under npm's default (no-prerelease) semantics, so tested-vs-published drift fails CI with a "overrides do not ship with published packages" hint instead of shipping silently. Needs semver, added as a root devDependency. Verified against the packed artifact: `pnpm pack` of this plugin-auth, installed into a fresh create-objectstack@15.1.0 project via a pnpm override — lockfile resolves the whole family (adapters + telemetry included) to 1.7.0-rc.1, startup log has zero "Failed to register OIDC discovery routes", and sign-up / sign-in / get-session all return 200. A control project without the override reproduces the three 500s. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 8e8c26c commit 01ba3b3

7 files changed

Lines changed: 343 additions & 15 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@objectstack/plugin-auth": patch
3+
---
4+
5+
Fix fresh-project auth returning 500 on every endpoint (sign-up / sign-in / get-session) with `Cannot set properties of undefined (setting 'modelName')`.
6+
7+
The published manifest declared `better-auth`, `@better-auth/core`, `@better-auth/oauth-provider`, and `@better-auth/sso` as `^1.6.23`, while only `@better-auth/scim` was pinned to `1.7.0-rc.1` (GHSA-j8v8-g9cx-5qf4 is fixed only in the 1.7.0 pre-release line). The framework workspace forces the whole better-auth family to `1.7.0-rc.1` via pnpm overrides, but overrides do not ship with published packages — a downstream `npx create-objectstack` install resolved the `^1.6.23` ranges to 1.6.23 (still the npm `latest`), and the resulting 1.7/1.6 mix crashes during better-auth initialization, so every fresh 15.1.0 project shipped with broken auth.
8+
9+
All four packages are now pinned to the exact `1.7.0-rc.1` — the only combination the workspace actually builds and tests against. The pins will be relaxed to `^1.7.0` once a stable better-auth 1.7.0 ships. A new CI gate (`scripts/check-override-consistency.mjs`) fails whenever a pnpm-workspace override target is not reachable from a publishable package's declared range, so tested-vs-published drift like this cannot recur silently.

.github/workflows/validate-deps.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- '.changeset/config.json'
99
- 'pnpm-workspace.yaml'
1010
- 'scripts/check-changeset-fixed.mjs'
11+
- 'scripts/check-override-consistency.mjs'
1112
# Re-run when the workflow itself changes, so edits to these gates are
1213
# exercised on the PR that introduces them.
1314
- '.github/workflows/validate-deps.yml'
@@ -58,6 +59,16 @@ jobs:
5859
5960
- name: Verify Changesets "fixed" group covers every public package
6061
run: node scripts/check-changeset-fixed.mjs
62+
63+
# pnpm overrides pin what THIS workspace resolves, but they do not ship
64+
# with published packages — downstream installs see only the declared
65+
# ranges. If an override target isn't reachable from a publishable
66+
# package's declared range, we test one dependency graph and publish
67+
# another (the 15.1.0 quickstart shipped exactly that: plugin-auth
68+
# declared better-auth ^1.6.23 while CI ran the 1.7.0-rc.1 override,
69+
# and every fresh project 500'd on auth).
70+
- name: Verify overrides are reflected in published manifests
71+
run: node scripts/check-override-consistency.mjs
6172

6273
# Fail the workflow if known vulnerabilities are found — enforces
6374
# security compliance before merging.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@types/node": "^26.1.1",
4747
"@typescript-eslint/parser": "^8.63.0",
4848
"eslint": "^10.7.0",
49+
"semver": "^7.7.3",
4950
"svelte": "^5.55.7",
5051
"tsup": "^8.5.1",
5152
"tsx": "^4.23.0",

packages/plugins/plugin-auth/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"test": "vitest run"
1919
},
2020
"dependencies": {
21-
"@better-auth/core": "^1.6.23",
22-
"@better-auth/oauth-provider": "^1.6.23",
21+
"@better-auth/core": "1.7.0-rc.1",
22+
"@better-auth/oauth-provider": "1.7.0-rc.1",
2323
"@better-auth/scim": "1.7.0-rc.1",
24-
"@better-auth/sso": "^1.6.23",
24+
"@better-auth/sso": "1.7.0-rc.1",
2525
"@noble/hashes": "^2.2.0",
2626
"@objectstack/core": "workspace:*",
2727
"@objectstack/platform-objects": "workspace:*",
2828
"@objectstack/rest": "workspace:*",
2929
"@objectstack/spec": "workspace:*",
3030
"@objectstack/types": "workspace:*",
31-
"better-auth": "^1.6.23",
31+
"better-auth": "1.7.0-rc.1",
3232
"jose": "^6.2.3"
3333
},
3434
"devDependencies": {

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,26 @@ onlyBuiltDependencies:
3030
# @vscode/vsce > cheerio (declares undici ^7.19.0); force the patched
3131
# 7.28.0 line (stays in the 7.x major cheerio supports). CI audit gate.
3232
# - @better-auth/scim: GHSA-j8v8-g9cx-5qf4 (high) — account/provider
33-
# takeover. `plugin-auth` depends on ^1.6.23 (the `latest` dist-tag), but
34-
# the advisory is patched only in >=1.7.0-beta.4 — there is NO stable
35-
# patched release yet. Pin to the newest pre-release (1.7.0-rc.1) to clear
36-
# the CI audit gate; revert to a stable `^1.7.x` line the moment one ships.
33+
# takeover. The advisory is patched only in >=1.7.0-beta.4 — there is NO
34+
# stable patched release yet (npm `latest` is still 1.6.23). Pin to the
35+
# newest pre-release (1.7.0-rc.1) to clear the CI audit gate; revert to a
36+
# stable `^1.7.x` line the moment one ships.
3737
# - @better-auth/oauth-provider: GHSA-p2fr-6hmx-4528 — same better-auth
38-
# monorepo and same situation as @better-auth/scim above. `plugin-auth`
39-
# depends on ^1.6.23; the fix first ships in the 1.7.0 pre-release line.
40-
# Pin to 1.7.0-rc.1. The 1.7 oauth-provider is exercised on the sign-in
41-
# path and imports symbols (e.g. CLIENT_ASSERTION_TYPE) that only exist in
42-
# @better-auth/core 1.7.x, so the ENTIRE better-auth family must move to
43-
# 1.7.0-rc.1 together — mixing a 1.7 plugin with 1.6.23 core 500s at
44-
# runtime (dogfood sign-in). The full family is pinned below; revert all of
38+
# monorepo and same situation as @better-auth/scim above. The fix first
39+
# ships in the 1.7.0 pre-release line. Pin to 1.7.0-rc.1. The 1.7
40+
# oauth-provider is exercised on the sign-in path and imports symbols
41+
# (e.g. CLIENT_ASSERTION_TYPE) that only exist in @better-auth/core 1.7.x,
42+
# so the ENTIRE better-auth family must move to 1.7.0-rc.1 together —
43+
# mixing a 1.7 plugin with 1.6.23 core throws "Cannot set properties of
44+
# undefined (setting 'modelName')" during better-auth init and 500s every
45+
# auth endpoint at runtime. The full family is pinned below; revert all of
4546
# them to a stable `^1.7.x` line the moment one ships.
47+
# IMPORTANT: these overrides do NOT ship with published packages — a
48+
# downstream `npx create-objectstack` install resolves plugin-auth's own
49+
# declared ranges. plugin-auth therefore pins the same exact 1.7.0-rc.1 in
50+
# its dependencies (a `^1.6.23` range there resolved to the broken 1.6.23
51+
# mix and 500'd every fresh 15.1.0 project). Keep both in sync — CI
52+
# enforces this via scripts/check-override-consistency.mjs.
4653
# - uuid: GHSA-w5hq-g745-h8pq (high) — pulled 8.3.2 transitively; the fix
4754
# first lands in 11.1.1. Pin to the ^11.1.1 LTS line (uuid `legacy-11`
4855
# dist-tag) rather than the latest major to keep the jump conservative.

0 commit comments

Comments
 (0)