[PR #3182] [CLOSED] Fix: JSON body not serialized in authClient.signUp.email (#3133) #30294

Closed
opened 2026-04-17 21:25:24 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3182
Author: @Adityakk9031
Created: 6/26/2025
Status: Closed

Base: mainHead: #3133


📝 Commits (7)

📊 Changes

2 files changed (+36 additions, -10 deletions)

View changed files

📝 packages/better-auth/src/client/proxy.ts (+34 -9)
📝 packages/expo/src/expo.test.ts (+2 -1)

📄 Description

This PR fixes a bug where authClient.signUp.email() sends a plain JS object instead of a serialized JSON string in the request body, causing the backend to receive [object Object].

Fix:

Wraps the body in JSON.stringify() before sending via fetch

Ensures proper "Content-Type": "application/json" header is included

Adjusts createDynamicPathProxy to serialize only for non-GET methods

📸 Reproduction
ts
Copy
Edit
await authClient.signUp.email({
email: "test@example.com",
password: "password1234",
name: "test",
});
Before: throws SyntaxError: "[object Object]" is not valid JSON
After: works as expected, backend receives correct payload.

🔬 Test Plan
Manually tested with backend better-auth/node

Confirmed body is now valid JSON

Verified no regression for GET requests

Tested with $fetch override — behaves identically

📦 Affected Packages
better-auth/vue (client)

🧩 Related Issues
Closes #3133


🔄 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/3182 **Author:** [@Adityakk9031](https://github.com/Adityakk9031) **Created:** 6/26/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `#3133` --- ### 📝 Commits (7) - [`3bf3d67`](https://github.com/better-auth/better-auth/commit/3bf3d674d1b3d7c08dff9a313193f6f3c438ecab) issue 3133 - [`cb01bdf`](https://github.com/better-auth/better-auth/commit/cb01bdff10d4d27f039c58ac31553ee649e84fff) biome - [`2aa5108`](https://github.com/better-auth/better-auth/commit/2aa5108b9ae9b5ab60076b664debb4eb71c9c75b) fix - [`f9c3fa6`](https://github.com/better-auth/better-auth/commit/f9c3fa6408f5d1213a543f99543099d22aa5343e) fixed - [`68b2e9f`](https://github.com/better-auth/better-auth/commit/68b2e9f00924a6d22bbdecaa2225c7cdbe689a45) fix - [`d4c9a59`](https://github.com/better-auth/better-auth/commit/d4c9a59f64fe3462de01a63ee6aab782689c3d8a) fix - [`8657c90`](https://github.com/better-auth/better-auth/commit/8657c90bd225fe110f55b837354fc1ac66ae8634) g ### 📊 Changes **2 files changed** (+36 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/client/proxy.ts` (+34 -9) 📝 `packages/expo/src/expo.test.ts` (+2 -1) </details> ### 📄 Description This PR fixes a bug where authClient.signUp.email() sends a plain JS object instead of a serialized JSON string in the request body, causing the backend to receive [object Object]. Fix: Wraps the body in JSON.stringify() before sending via fetch Ensures proper "Content-Type": "application/json" header is included Adjusts createDynamicPathProxy to serialize only for non-GET methods 📸 Reproduction ts Copy Edit await authClient.signUp.email({ email: "test@example.com", password: "password1234", name: "test", }); Before: throws SyntaxError: "[object Object]" is not valid JSON After: works as expected, backend receives correct payload. 🔬 Test Plan Manually tested with backend better-auth/node Confirmed body is now valid JSON Verified no regression for GET requests Tested with $fetch override — behaves identically 📦 Affected Packages better-auth/vue (client) 🧩 Related Issues Closes [#3133](https://github.com/your-org/better-auth/issues/3133) --- <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-17 21:25:25 -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#30294