[PR #4713] [MERGED] fix(adapter): returning null as string for optional id references #5543

Closed
opened 2026-03-13 12:26:40 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4713
Author: @jslno
Created: 9/16/2025
Status: Merged
Merged: 9/17/2025
Merged by: @himself65

Base: canaryHead: fix-adapter-factory/casting-null-as-string


📝 Commits (4)

  • ec1c02a fix(adapter): returning null as string for optional id references
  • e3c3088 chore: fix linting
  • c2afd33 chore: add test
  • e4a3f1f chore: fix linting

📊 Changes

2 files changed (+49 additions, -1 deletions)

View changed files

📝 packages/better-auth/src/adapters/adapter-factory/index.ts (+2 -1)
📝 packages/better-auth/src/adapters/adapter-factory/test/adapter-factory.test.ts (+47 -0)

📄 Description

Summary by cubic

Prevents optional id fields from being cast to the string "null" in the adapter factory. Now only defined, non-null ids are stringified; null remains null.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4713 **Author:** [@jslno](https://github.com/jslno) **Created:** 9/16/2025 **Status:** ✅ Merged **Merged:** 9/17/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix-adapter-factory/casting-null-as-string` --- ### 📝 Commits (4) - [`ec1c02a`](https://github.com/better-auth/better-auth/commit/ec1c02acb82a15b9a881fbd179904e9449f8da8e) fix(adapter): returning null as string for optional id references - [`e3c3088`](https://github.com/better-auth/better-auth/commit/e3c308818a0a265af80712306f87d04ef0172d30) chore: fix linting - [`c2afd33`](https://github.com/better-auth/better-auth/commit/c2afd33f009a4673df2f6da0705f9556a39eb61b) chore: add test - [`e4a3f1f`](https://github.com/better-auth/better-auth/commit/e4a3f1f82dc56a18a1ec670428c1f55028ee88a3) chore: fix linting ### 📊 Changes **2 files changed** (+49 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/adapters/adapter-factory/index.ts` (+2 -1) 📝 `packages/better-auth/src/adapters/adapter-factory/test/adapter-factory.test.ts` (+47 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Prevents optional id fields from being cast to the string "null" in the adapter factory. Now only defined, non-null ids are stringified; null remains null. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:26:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#5543