Skip to content

chore: use better-call v2#8021

Merged
himself65 merged 7 commits intocanaryfrom
himself65/2026/02/17/better-call
Mar 3, 2026
Merged

chore: use better-call v2#8021
himself65 merged 7 commits intocanaryfrom
himself65/2026/02/17/better-call

Conversation

@himself65
Copy link
Copy Markdown
Contributor

@himself65 himself65 commented Feb 17, 2026

Summary by cubic

Pinned better-call to the v2 PR tarball across the workspace to adopt the new build without changing app code.

Written for commit 8b2ecbe. Summary will update on new commits.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
better-auth-docs Ready Ready Preview, Comment Mar 3, 2026 4:04am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
better-auth-demo Ignored Ignored Mar 3, 2026 4:04am

Request Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 17, 2026

Open in StackBlitz

@better-auth/api-key

npm i https://pkg.pr.new/@better-auth/api-key@8021

better-auth

npm i https://pkg.pr.new/better-auth@8021

auth

npm i https://pkg.pr.new/auth@8021

@better-auth/core

npm i https://pkg.pr.new/@better-auth/core@8021

@better-auth/drizzle-adapter

npm i https://pkg.pr.new/@better-auth/drizzle-adapter@8021

@better-auth/electron

npm i https://pkg.pr.new/@better-auth/electron@8021

@better-auth/expo

npm i https://pkg.pr.new/@better-auth/expo@8021

@better-auth/i18n

npm i https://pkg.pr.new/@better-auth/i18n@8021

@better-auth/kysely-adapter

npm i https://pkg.pr.new/@better-auth/kysely-adapter@8021

@better-auth/memory-adapter

npm i https://pkg.pr.new/@better-auth/memory-adapter@8021

@better-auth/mongo-adapter

npm i https://pkg.pr.new/@better-auth/mongo-adapter@8021

@better-auth/oauth-provider

npm i https://pkg.pr.new/@better-auth/oauth-provider@8021

@better-auth/passkey

npm i https://pkg.pr.new/@better-auth/passkey@8021

@better-auth/prisma-adapter

npm i https://pkg.pr.new/@better-auth/prisma-adapter@8021

@better-auth/redis-storage

npm i https://pkg.pr.new/@better-auth/redis-storage@8021

@better-auth/scim

npm i https://pkg.pr.new/@better-auth/scim@8021

@better-auth/sso

npm i https://pkg.pr.new/@better-auth/sso@8021

@better-auth/stripe

npm i https://pkg.pr.new/@better-auth/stripe@8021

@better-auth/telemetry

npm i https://pkg.pr.new/@better-auth/telemetry@8021

@better-auth/test-utils

npm i https://pkg.pr.new/@better-auth/test-utils@8021

commit: e58b368

@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 07:07 Inactive
@himself65 himself65 force-pushed the himself65/2026/02/17/better-call branch from e093ff8 to 106213b Compare February 27, 2026 07:12
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 08:15 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 08:16 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 12:22 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 15:52 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 17:25 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 17:35 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 17:47 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs February 27, 2026 17:58 Inactive
@himself65 himself65 marked this pull request as ready for review March 2, 2026 10:07
@himself65 himself65 requested a review from Bekacru as a code owner March 2, 2026 10:07
Copilot AI review requested due to automatic review settings March 2, 2026 10:07
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 28 files

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the workspace to consume the better-call “v2” build (via a PR tarball) and applies the corresponding type-shape adjustments across @better-auth/core and better-auth (endpoints, contexts, client inference, and OpenAPI generation), plus test updates to match the new typings.

Changes:

  • Pin better-call to a pkg.pr.new tarball in the workspace catalog/lockfile.
  • Update endpoint/context-related TypeScript types to match better-call v2 generic parameters and runtime option types.
  • Adjust client/type tests and some schemas to compile under the new better-call typings.

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Pins better-call to a pkg.pr.new tarball via the workspace catalog.
pnpm-lock.yaml Updates lockfile entries to use the tarball specifier and adds the tarball package resolution/snapshot.
packages/core/src/types/plugin.ts Updates hook endpoint context typing and broadens hook handler typing.
packages/core/src/types/context.ts Updates GenericEndpointContext typing to match new EndpointContext generic shape.
packages/core/src/context/endpoint-context.ts Updates AuthEndpointContext typing to new better-call v2 generics.
packages/core/src/api/index.ts Reworks createAuthEndpoint typing/overloads for better-call v2 and updates exported types.
packages/better-auth/src/types/helper.ts Adjusts HasRequiredKeys to behave better with any/non-object inputs.
packages/better-auth/src/types/api.ts Updates API filtering types to infer endpoint metadata via Endpoint generics.
packages/better-auth/src/plugins/organization/schema.ts Switches Prettify import from better-call to a local helper type.
packages/better-auth/src/plugins/organization/routes/crud-members.test.ts Test typing adjustments for org member invite role validation.
packages/better-auth/src/plugins/organization/routes/crud-access-control.test.ts Test typing adjustments (as string/as any) for org IDs and request bodies.
packages/better-auth/src/plugins/organization/organization.ts Updates has-permission request schema (notably permission/permissions fields).
packages/better-auth/src/plugins/organization/organization.test.ts Updates type assertions and adds as any casts due to runtime schema merges / new endpoint typings.
packages/better-auth/src/plugins/organization/client.test.ts Updates typing tests to compile under new inference (casts to any).
packages/better-auth/src/plugins/open-api/generator.ts Switches option typing to EndpointRuntimeOptions for better-call v2.
packages/better-auth/src/plugins/anonymous/types.ts Updates EndpointContext generic parameters to match v2.
packages/better-auth/src/plugins/admin/routes.ts Updates has-permission request schema (notably permission/permissions fields).
packages/better-auth/src/client/path-to-object.ts Updates client route/input inference types for new InputContext/Endpoint metadata generics.
packages/better-auth/src/client/client.test.ts Updates expected error type shape under better-call v2 endpoint generic behavior.
packages/better-auth/src/api/to-auth-endpoints.ts Updates internal endpoint/context typings and hook handler typing to match v2.
packages/better-auth/src/api/to-auth-endpoints.test.ts Adjusts tests with casts to satisfy new endpoint input typings.
packages/better-auth/src/api/routes/update-user.ts Normalizes @ts-expect-error comment formatting.
packages/better-auth/src/api/routes/update-user.test.ts Removes an expectation of a TS error for an extra field (typing change).
packages/better-auth/src/api/routes/sign-up.test.ts Removes a @ts-expect-error suppression for a custom field (typing change).
packages/better-auth/src/api/routes/account.ts Forces query: undefined when calling getAccessToken from accountInfo.
packages/better-auth/src/api/rate-limiter/rate-limiter.test.ts Adds @ts-expect-error for extra runtime query param on fetch options.
packages/better-auth/src/api/middlewares/origin-check.test.ts Adds @ts-expect-error for extra runtime query param on fetch options.
packages/better-auth/src/api/index.test.ts Casts test middleware context to any to satisfy updated middleware typing.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Opts extends EndpointOptions,
R,
> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
export type AuthEndpoint = ReturnType<typeof createAuthEndpoint>;
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export type AuthEndpoint = ReturnType<typeof createAuthEndpoint> is no longer parameterized, which is a breaking type-level API change for any consumers that previously referenced AuthEndpoint<Path, Opts, R>. Consider reintroducing a generic AuthEndpoint<...> alias (possibly mapping to the new better-call v2 Endpoint<...> shape) and/or keeping this non-generic alias under a different name to avoid downstream breakage.

Suggested change
export type AuthEndpoint = ReturnType<typeof createAuthEndpoint>;
export type AuthEndpoint<
Path extends string = string,
Method extends HTTPMethod | HTTPMethod[] | "*" = any,
Body = any,
Query = any,
Headers = any,
R = unknown,
Meta extends EndpointMetadata | undefined = undefined,
> = Endpoint<Path, Method, Body, Query, Headers, R, Meta>;
export type AuthEndpointInstance = ReturnType<typeof createAuthEndpoint>;

Copilot uses AI. Check for mistakes.
Comment on lines 167 to 175
z.union([
z.object({
permission: z.record(z.string(), z.array(z.string())),
permissions: z.undefined(),
permissions: z.record(z.string(), z.array(z.string())).optional(),
}),
z.object({
permission: z.undefined(),
permission: z.record(z.string(), z.array(z.string())).optional(),
permissions: z.record(z.string(), z.array(z.string())),
}),
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createHasPermissionBodySchema no longer enforces mutual exclusivity between permission (deprecated) and permissions. With the new .optional() fields, requests providing only permission will now pass schema validation but ctx.body.permissions will be undefined and get forwarded into hasPermission(...), producing incorrect results. Restore the XOR behavior (e.g., use z.never().optional() for the disallowed key) and/or add explicit mapping so deprecated permission is handled correctly.

Copilot uses AI. Check for mistakes.
Comment on lines 11 to 14
'@better-auth/utils': 0.3.1
'@better-fetch/fetch': 1.1.21
better-call: 1.3.2
better-call: https://pkg.pr.new/better-call@382e963
tsdown: ^0.20.3
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says better-call is pinned to the v2 PR tarball at https://pkg.pr.new/better-auth/better-call@109, but the workspace catalog is actually set to https://pkg.pr.new/better-call@382e963. Please align the description and the pinned tarball URL (and ideally document why we’re relying on a pkg.pr.new tarball instead of a published version, since it can affect long-term reproducibility).

Copilot uses AI. Check for mistakes.
@himself65
Copy link
Copy Markdown
Contributor Author

Related

Zod type re-export / namespace leaking

"Cannot be named without a reference" (TS2742) — type portability

Type instantiation / TypeScript performance

Zod schema type inference

Bundle size (related to zod bundling)

This reverts commit f67aef5.
@vercel vercel bot temporarily deployed to Preview – better-auth-docs March 2, 2026 21:21 Inactive
@vercel vercel bot temporarily deployed to Preview – better-auth-docs March 3, 2026 03:58 Inactive
@himself65 himself65 disabled auto-merge March 3, 2026 04:01
@himself65 himself65 enabled auto-merge March 3, 2026 04:04
@himself65 himself65 added this pull request to the merge queue Mar 3, 2026
Merged via the queue into canary with commit 29b7567 Mar 3, 2026
23 checks passed
rae-fcm pushed a commit to FullCodeMedical/better-auth that referenced this pull request Mar 9, 2026
@himself65 himself65 mentioned this pull request Mar 13, 2026
8 tasks
himself65 added a commit that referenced this pull request Mar 20, 2026
himself65 added a commit that referenced this pull request Mar 20, 2026
@better-auth better-auth locked as resolved and limited conversation to collaborators Apr 1, 2026
@bytaesu bytaesu added the locked Locked conversations after being closed for 7 days label Apr 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked Locked conversations after being closed for 7 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants