[PR #3947] [MERGED] fix: prevent static nodejs imports and lazy import for non-nodejs env #13349

Closed
opened 2026-04-13 08:52:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3947
Author: @Kinfe123
Created: 8/12/2025
Status: Merged
Merged: 8/13/2025
Merged by: @Bekacru

Base: canaryHead: fix/cf-compat-runtime-resolution


📝 Commits (10+)

  • 0d16d8e fix(cli): incorrect api for auto increment in drizzle schema generation(#3940)
  • 4e52900 fix(organization): make plugin schema compatible with exactOptionalPropertyTypes; build schema object without undefined optional keys and merge team tables conditionally; keep session fields literal and add teams conditionally
  • 16fc2c6 fix: restore non-Node.js support by lazily importing
  • 6cd5419 test
  • f93e0d0 cleanup
  • 794eb97 clean up
  • 2eca2b7 lint
  • b332ff6 fix(email-otp): type issue with extractOptionPropertyTypes (#3961)
  • 6f786d9 Merge branch 'main' into fix/cf-compat-runtime-resolution
  • 84f8f65 docs: add github star count in the community section (#3960)

📊 Changes

9 files changed (+215 additions, -96 deletions)

View changed files

📝 docs/app/community/_components/header.tsx (+1 -19)
📝 docs/app/community/_components/stats.tsx (+121 -31)
📝 docs/app/community/page.tsx (+9 -7)
📝 packages/better-auth/src/plugins/email-otp/index.ts (+15 -16)
📝 packages/better-auth/src/telemetry/detectors/detect-runtime.ts (+4 -1)
📝 packages/better-auth/src/telemetry/detectors/detect-system-info.ts (+17 -7)
📝 packages/better-auth/src/telemetry/telemetry.test.ts (+21 -0)
📝 packages/better-auth/src/utils/package-json.ts (+26 -14)
📝 packages/cli/src/generators/drizzle.ts (+1 -1)

📄 Description

closes #3945

Summary by cubic

Updated telemetry and package utilities to prevent static Node.js imports and use lazy imports for better runtime compatibility, including support for edge and Cloudflare environments.

  • Bug Fixes
  • Replaced static imports of Node.js modules with dynamic imports to avoid bundler issues in non-Node runtimes.
  • Improved runtime detection to handle edge environments without Node.js globals.
  • Updated tests to verify initialization in edge-like environments.

🔄 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/3947 **Author:** [@Kinfe123](https://github.com/Kinfe123) **Created:** 8/12/2025 **Status:** ✅ Merged **Merged:** 8/13/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `canary` ← **Head:** `fix/cf-compat-runtime-resolution` --- ### 📝 Commits (10+) - [`0d16d8e`](https://github.com/better-auth/better-auth/commit/0d16d8e02c52d97725d5781eb1420ef95fc629c1) fix(cli): incorrect api for auto increment in drizzle schema generation(#3940) - [`4e52900`](https://github.com/better-auth/better-auth/commit/4e52900140f81d001ea04fca32b5674a265aaca9) fix(organization): make plugin schema compatible with exactOptionalPropertyTypes; build schema object without undefined optional keys and merge team tables conditionally; keep session fields literal and add teams conditionally - [`16fc2c6`](https://github.com/better-auth/better-auth/commit/16fc2c65d85202bce89e5e833ab619839646431c) fix: restore non-Node.js support by lazily importing - [`6cd5419`](https://github.com/better-auth/better-auth/commit/6cd5419d03c7580d5457372d5090f65d2fa1e935) test - [`f93e0d0`](https://github.com/better-auth/better-auth/commit/f93e0d07a5e50eb51331d340452e3d3d4c99d382) cleanup - [`794eb97`](https://github.com/better-auth/better-auth/commit/794eb9723a9aa40afc7760eecafd0bb4d46b2805) clean up - [`2eca2b7`](https://github.com/better-auth/better-auth/commit/2eca2b71f9221e863199244a7f4e92ac4080e800) lint - [`b332ff6`](https://github.com/better-auth/better-auth/commit/b332ff620ee0644c320e5f0f649ad66696bf61ab) fix(email-otp): type issue with extractOptionPropertyTypes (#3961) - [`6f786d9`](https://github.com/better-auth/better-auth/commit/6f786d97e23b5381564fef124d334f0c20e8bac1) Merge branch 'main' into fix/cf-compat-runtime-resolution - [`84f8f65`](https://github.com/better-auth/better-auth/commit/84f8f659cee8ee2fbc7d7e5333d0c76a9fed216c) docs: add github star count in the community section (#3960) ### 📊 Changes **9 files changed** (+215 additions, -96 deletions) <details> <summary>View changed files</summary> 📝 `docs/app/community/_components/header.tsx` (+1 -19) 📝 `docs/app/community/_components/stats.tsx` (+121 -31) 📝 `docs/app/community/page.tsx` (+9 -7) 📝 `packages/better-auth/src/plugins/email-otp/index.ts` (+15 -16) 📝 `packages/better-auth/src/telemetry/detectors/detect-runtime.ts` (+4 -1) 📝 `packages/better-auth/src/telemetry/detectors/detect-system-info.ts` (+17 -7) 📝 `packages/better-auth/src/telemetry/telemetry.test.ts` (+21 -0) 📝 `packages/better-auth/src/utils/package-json.ts` (+26 -14) 📝 `packages/cli/src/generators/drizzle.ts` (+1 -1) </details> ### 📄 Description closes #3945 <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Updated telemetry and package utilities to prevent static Node.js imports and use lazy imports for better runtime compatibility, including support for edge and Cloudflare environments. - **Bug Fixes** - Replaced static imports of Node.js modules with dynamic imports to avoid bundler issues in non-Node runtimes. - Improved runtime detection to handle edge environments without Node.js globals. - Updated tests to verify initialization in edge-like environments. <!-- 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-04-13 08:52:51 -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#13349