[GH-ISSUE #8796] kysely-adapter D1 dialect still returns deprecated QueryResult.numUpdatedOrDeletedRows, causing Kysely warning #11193

Closed
opened 2026-04-13 07:32:45 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @redbg on GitHub (Mar 27, 2026).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/8796

Originally assigned to: @ping-maxwell, @bytaesu on GitHub.

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Summary

When using Better Auth with native Cloudflare D1 support, Worker logs show a Kysely warning:

kysely⚠️ outdated driver/plugin detected! QueryResult.numUpdatedOrDeletedRows has been replaced with QueryResult.numAffectedRows.

This appears to come from Better Auth's D1 Kysely dialect returning the deprecated numUpdatedOrDeletedRows field alongside numAffectedRows.

Versions

  • better-auth: 1.5.6
  • @better-auth/kysely-adapter: 1.5.6
  • kysely: 0.28.14
  • Runtime: Cloudflare Workers + D1

Current vs. Expected behavior

Image Image

What version of Better Auth are you using?

1.5.6

System info

{
  "system": {
    "platform": "win32",
    "arch": "x64",
    "version": "Windows 11 Pro",
    "release": "10.0.26200",
    "cpuCount": 24,
    "cpuModel": "Intel(R) Core(TM) Ultra 9 275HX",
    "totalMemory": "31.43 GB",
    "freeMemory": "10.38 GB"
  },
  "node": {
    "version": "v24.14.0",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.9.0"
  },
  "frameworks": [
    {
      "name": "vue",
      "version": "^3.5.31"
    },
    {
      "name": "hono",
      "version": "^4.12.9"
    }
  ],
  "databases": null,
  "betterAuth": {
    "version": "^1.5.6",
    "config": {}
  }
}

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { env } from "cloudflare:workers";
import { betterAuth } from "better-auth";

export const auth = betterAuth({ database: env.DB });

Additional context

cloudflare d1 , 本地和远程都会出现这个警告

Originally created by @redbg on GitHub (Mar 27, 2026). Original GitHub issue: https://github.com/better-auth/better-auth/issues/8796 Originally assigned to: @ping-maxwell, @bytaesu on GitHub. ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce ## Summary When using Better Auth with native Cloudflare D1 support, Worker logs show a Kysely warning: > kysely:warning: outdated driver/plugin detected! `QueryResult.numUpdatedOrDeletedRows` has been replaced with `QueryResult.numAffectedRows`. This appears to come from Better Auth's D1 Kysely dialect returning the deprecated `numUpdatedOrDeletedRows` field alongside `numAffectedRows`. ## Versions - `better-auth`: `1.5.6` - `@better-auth/kysely-adapter`: `1.5.6` - `kysely`: `0.28.14` - Runtime: Cloudflare Workers + D1 ### Current vs. Expected behavior <img width="781" height="71" alt="Image" src="https://github.com/user-attachments/assets/ded932c3-7889-4c2f-a404-5925da537851" /> <img width="521" height="127" alt="Image" src="https://github.com/user-attachments/assets/0ad749e9-5e76-41f3-a023-7ba1d31582d0" /> ### What version of Better Auth are you using? 1.5.6 ### System info ```bash { "system": { "platform": "win32", "arch": "x64", "version": "Windows 11 Pro", "release": "10.0.26200", "cpuCount": 24, "cpuModel": "Intel(R) Core(TM) Ultra 9 275HX", "totalMemory": "31.43 GB", "freeMemory": "10.38 GB" }, "node": { "version": "v24.14.0", "env": "development" }, "packageManager": { "name": "npm", "version": "11.9.0" }, "frameworks": [ { "name": "vue", "version": "^3.5.31" }, { "name": "hono", "version": "^4.12.9" } ], "databases": null, "betterAuth": { "version": "^1.5.6", "config": {} } } ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { env } from "cloudflare:workers"; import { betterAuth } from "better-auth"; export const auth = betterAuth({ database: env.DB }); ``` ### Additional context cloudflare d1 , 本地和远程都会出现这个警告
GiteaMirror added the databaselockedbug labels 2026-04-13 07:32:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 27, 2026):

Hi @redbg! I'm Dosu and I’m helping the better-auth team.

Thanks for reporting this! You've identified the exact source of the warning. In packages/kysely-adapter/src/d1-sqlite-dialect.ts (line 111), the D1 dialect intentionally returns both properties:

return {
    insertId: ...,
    rows: (results?.results as O[]) || [],
    numAffectedRows,
    // @ts-expect-error - deprecated in kysely >= 0.23, keep for backward compatibility
    numUpdatedOrDeletedRows: numAffectedRows,
};

This was kept for backward compatibility with Kysely versions < 0.23. Since you're using Kysely 0.28.14, this deprecated property triggers the warning. The warning is cosmetic and doesn't affect functionality.

Given that Kysely 0.23+ has been out for a while, it may be reasonable to remove numUpdatedOrDeletedRows from the D1 dialect. I didn't find any existing issues or PRs addressing this specifically.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

<!-- gh-comment-id:4139156390 --> @dosubot[bot] commented on GitHub (Mar 27, 2026): <!-- Greeting --> Hi @redbg! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> Thanks for reporting this! You've identified the exact source of the warning. In [`packages/kysely-adapter/src/d1-sqlite-dialect.ts` (line 111)](https://github.com/better-auth/better-auth/blob/3d5dfd2089f81f3ffe4479cffda71d0596e6f29e/packages/kysely-adapter/src/d1-sqlite-dialect.ts#L111), the D1 dialect intentionally returns both properties: ```typescript return { insertId: ..., rows: (results?.results as O[]) || [], numAffectedRows, // @ts-expect-error - deprecated in kysely >= 0.23, keep for backward compatibility numUpdatedOrDeletedRows: numAffectedRows, }; ``` This was kept for backward compatibility with Kysely versions < 0.23. Since you're using Kysely 0.28.14, this deprecated property triggers the warning. The warning is cosmetic and doesn't affect functionality. Given that Kysely 0.23+ has been out for a while, it may be reasonable to remove `numUpdatedOrDeletedRows` from the D1 dialect. I didn't find any existing issues or PRs addressing this specifically. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b19b5fff-cad8-4c40-9860-38a2f3b2679f?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b19b5fff-cad8-4c40-9860-38a2f3b2679f?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b19b5fff-cad8-4c40-9860-38a2f3b2679f?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b19b5fff-cad8-4c40-9860-38a2f3b2679f?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b19b5fff-cad8-4c40-9860-38a2f3b2679f?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b19b5fff-cad8-4c40-9860-38a2f3b2679f?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report) | [Other](https://app.dosu.dev/response-feedback/b19b5fff-cad8-4c40-9860-38a2f3b2679f?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Thanks%20for%20reporting%20this%21%20You%27ve%20identified%20the%20exact%20source%20of%20the%20warning.%20In%20%5B%60packages/kysely-adapter/src/d1-sqlite-dialect.ts%60%20%28line%20111%29%5D%28https%3A//github.com/better-auth/better-auth/blob/3d5dfd2089f81f3ffe4479cffda71d0596e6f29e/packages/kysely-adapter/src/d1-sqlite-dialect.ts%23L111%29%2C%20the%20D1%20dialect%20intentionally%20returns%20both%20properties%3A%0A%0A%60%60%60typescript%0Areturn%20%7B%0A%20%20%20%20insertId%3A%20...%2C%0A%20%20%20%20rows%3A%20%28results%3F.results%20as%20O%5B%5D%29%20%7C%7C%20%5B%5D%2C%0A%20%20%20%20numAffectedRows%2C%0A%20%20%20%20//%20%40ts-expect-error%20-%20deprecated%20in%20kysely%20%3E%3D%200.23%2C%20keep%20for%20backward%20compatibility%0A%20%20%20%20numUpdatedOrDeletedRows%3A%20numAffectedRows%2C%0A%7D%3B%0A%60%60%60%0A%0AThis%20was%20kept%20for%20backward%20compatibility%20with%20Kysely%20versions%20%3C%200.23.%20Since%20you%27re%20using%20Kysely%200.28.14%2C%20this%20deprecated%20property%20triggers%20the%20warning.%20The%20warning%20is%20cosmetic%20and%20doesn%27t%20affect%20functionality.%0A%0AGiven%20that%20Kysely%200.23%2B%20has%20been%20out%20for%20a%20while%2C%20it%20may%20be%20reasonable%20to%20remove%20%60numUpdatedOrDeletedRows%60%20from%20the%20D1%20dialect.%20I%20didn%27t%20find%20any%20existing%20issues%20or%20PRs%20addressing%20this%20specifically.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/8796)
Author
Owner

@bytaesu commented on GitHub (Mar 27, 2026):

Thanks for letting us know @redbg
I'll open a PR

<!-- gh-comment-id:4139953390 --> @bytaesu commented on GitHub (Mar 27, 2026): Thanks for letting us know @redbg I'll open a PR
Author
Owner

@github-actions[bot] commented on GitHub (Apr 4, 2026):

This issue has been locked as it was closed more than 7 days ago. If you're experiencing a similar problem or you have additional context, please open a new issue and reference this one.

<!-- gh-comment-id:4185770584 --> @github-actions[bot] commented on GitHub (Apr 4, 2026): This issue has been locked as it was closed more than 7 days ago. If you're experiencing a similar problem or you have additional context, please open a new issue and reference this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#11193