Elysiajs react client can't getting session #1893

Closed
opened 2026-03-13 09:11:05 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @xkalf on GitHub (Sep 10, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

elysiajs macro

async function getSession(headers: Headers) {
	const session = await auth.api.getSession({ headers });

	if (!session) {
		return status("Unauthorized", "Unauthorized");
	}

	return {
		user: session.user,
		session: session.session,
	};
}

const betterAuthMacro = new Elysia({ name: "betterAuth" }).macro({
	auth: {
		resolve({ request: { headers }, cookie }) {
			console.log(cookie);
			console.log(headers);
			return getSession(headers);
		},
	},

this is console logged cookie and header

{
  accessToken: {
    value: "KoTs4PVi72q1HlGlbS6Aag4f82HqPcBt.JumY1h74P8tUHKxySDO2a7Dvs3gH3afDCE9vzAoKkSk=",
  },
}
Headers {
  "host": "localhost:3000",
  "connection": "keep-alive",
  "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
  "dnt": "1",
  "content-type": "application/json",
  "accept": "*/*",
  "origin": "http://localhost:3001",
  "sec-fetch-mode": "cors",
  "sec-fetch-dest": "empty",
  "referer": "http://localhost:3001/",
  "accept-encoding": "gzip, deflate, br, zstd",
  "accept-language": "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7",
  "cookie": "accessToken=KoTs4PVi72q1HlGlbS6Aag4f82HqPcBt.JumY1h74P8tUHKxySDO2a7Dvs3gH3afDCE9vzAoKkSk%253D",
  "sec-ch-ua-platform": "\"macOS\"",
  "sec-ch-ua": "\"Not=A?Brand\";v=\"24\", \"Chromium\";v=\"140\"",
  "sec-ch-ua-mobile": "?0",
  "sec-fetch-site": "same-site",
}

in react client
export const apiClient = treaty(API_URL, {
fetch: { credentials: "include" },
// headers: {
// Authorization: Bearer ${token},
// },
});

cors setup

	.use(
		cors({
			origin: ["http://localhost:3001"],
			methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
			credentials: true,
			allowedHeaders: ["Content-Type", "Authorization"],
		}),
	)

Current vs. Expected behavior

i need to get const session = await auth.api.getSession({ headers });
is not null

What version of Better Auth are you using?

1.3.9

System info

getting null working on 
m4 macbook pro

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

Backend, Client

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
	database: drizzleAdapter(db, {
		provider: "pg",
	}),
	emailAndPassword: {
		enabled: true,
	},
	plugins: [openAPI(), bearer()],
	basePath: "/api",
	secondaryStorage,
	user: {
		additionalFields: {
			branchId: {
				type: "string",
			},
			companyId: {
				type: "string",
			},
			kind: {
				type: userKindEnum.enumValues,
				defaultValue: "CUSTOMER",
			},
			employeeId: {
				type: "string",
				required: false,
			},
		},
	},
	logger: {
		log(level, ...args) {
			if (
				level === "error" &&
				args[0] === "Error" &&
				args.length === 2 &&
				args[1] instanceof Error &&
				args[1].message === "NOT_FOUND"
			)
				return;
			console[level](...args);
		},
	},
	telemetry: {
		enabled: false, // Disable telemetry for privacy
	},
	advanced: {
		defaultCookieAttributes: {
			sameSite: "none",
			secure: false,
			httpOnly: true,
		},
	},
});

Additional context

No response

Originally created by @xkalf on GitHub (Sep 10, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce elysiajs macro ```typescript async function getSession(headers: Headers) { const session = await auth.api.getSession({ headers }); if (!session) { return status("Unauthorized", "Unauthorized"); } return { user: session.user, session: session.session, }; } const betterAuthMacro = new Elysia({ name: "betterAuth" }).macro({ auth: { resolve({ request: { headers }, cookie }) { console.log(cookie); console.log(headers); return getSession(headers); }, }, ``` this is console logged cookie and header ``` { accessToken: { value: "KoTs4PVi72q1HlGlbS6Aag4f82HqPcBt.JumY1h74P8tUHKxySDO2a7Dvs3gH3afDCE9vzAoKkSk=", }, } Headers { "host": "localhost:3000", "connection": "keep-alive", "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36", "dnt": "1", "content-type": "application/json", "accept": "*/*", "origin": "http://localhost:3001", "sec-fetch-mode": "cors", "sec-fetch-dest": "empty", "referer": "http://localhost:3001/", "accept-encoding": "gzip, deflate, br, zstd", "accept-language": "ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7", "cookie": "accessToken=KoTs4PVi72q1HlGlbS6Aag4f82HqPcBt.JumY1h74P8tUHKxySDO2a7Dvs3gH3afDCE9vzAoKkSk%253D", "sec-ch-ua-platform": "\"macOS\"", "sec-ch-ua": "\"Not=A?Brand\";v=\"24\", \"Chromium\";v=\"140\"", "sec-ch-ua-mobile": "?0", "sec-fetch-site": "same-site", } ``` in react client export const apiClient = treaty<App>(API_URL, { fetch: { credentials: "include" }, // headers: { // Authorization: `Bearer ${token}`, // }, }); cors setup ``` .use( cors({ origin: ["http://localhost:3001"], methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"], credentials: true, allowedHeaders: ["Content-Type", "Authorization"], }), ) ``` ### Current vs. Expected behavior i need to get const session = await auth.api.getSession({ headers }); is not null ### What version of Better Auth are you using? 1.3.9 ### System info ```bash getting null working on m4 macbook pro ``` ### Which area(s) are affected? (Select all that apply) Backend, Client ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ database: drizzleAdapter(db, { provider: "pg", }), emailAndPassword: { enabled: true, }, plugins: [openAPI(), bearer()], basePath: "/api", secondaryStorage, user: { additionalFields: { branchId: { type: "string", }, companyId: { type: "string", }, kind: { type: userKindEnum.enumValues, defaultValue: "CUSTOMER", }, employeeId: { type: "string", required: false, }, }, }, logger: { log(level, ...args) { if ( level === "error" && args[0] === "Error" && args.length === 2 && args[1] instanceof Error && args[1].message === "NOT_FOUND" ) return; console[level](...args); }, }, telemetry: { enabled: false, // Disable telemetry for privacy }, advanced: { defaultCookieAttributes: { sameSite: "none", secure: false, httpOnly: true, }, }, }); ``` ### Additional context _No response_
GiteaMirror added the elysiabug labels 2026-03-13 09:11:06 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 10, 2025):

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

Your session is returning null because Better Auth expects a properly signed and URL-encoded session cookie, not just a raw access token. The cookie in your headers is named accessToken, but Better Auth looks for a cookie named better-auth.session_token or __Secure-better-auth.session_token depending on your config and environment. If the cookie is missing, named incorrectly, or not signed/encoded as expected, session retrieval will fail 1 2.

To fix this:

  1. Make sure your authentication flow sets the session cookie using Better Auth's helpers (like authClient.getCookie() on the client), not by manually setting an access token.
  2. In cross-origin setups, set your cookie attributes to sameSite: "none", secure: true, and httpOnly: true 3 4.
  3. Ensure your fetch requests use credentials: "include" and your CORS config allows credentials and the correct origin.
  4. If you use the bearer plugin, make sure you send the token as a Bearer token in the Authorization header, not as a cookie, and let the plugin handle converting it to a session cookie 5.
  5. If you need to forward cookies from a proxy or server action, forward the entire cookie header as-is to the backend session endpoint 6.

If you follow these steps and use the correct cookie name and signing, auth.api.getSession({ headers }) should return a valid session. If it still returns null, double-check your cookie config and try upgrading to the latest Better Auth version in case you are hitting a known bug 2.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 10, 2025): <!-- Greeting --> Hi @xkalf! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> Your session is returning null because Better Auth expects a properly signed and URL-encoded session cookie, not just a raw access token. The cookie in your headers is named `accessToken`, but Better Auth looks for a cookie named `better-auth.session_token` or `__Secure-better-auth.session_token` depending on your config and environment. If the cookie is missing, named incorrectly, or not signed/encoded as expected, session retrieval will fail [1](https://github.com/better-auth/better-auth/issues/4517) [2](https://github.com/better-auth/better-auth/issues/3892). To fix this: 1. Make sure your authentication flow sets the session cookie using Better Auth's helpers (like `authClient.getCookie()` on the client), not by manually setting an access token. 2. In cross-origin setups, set your cookie attributes to `sameSite: "none"`, `secure: true`, and `httpOnly: true` [3](https://github.com/better-auth/better-auth/issues/3470) [4](https://github.com/better-auth/better-auth/issues/4188). 3. Ensure your fetch requests use `credentials: "include"` and your CORS config allows credentials and the correct origin. 4. If you use the bearer plugin, make sure you send the token as a Bearer token in the Authorization header, not as a cookie, and let the plugin handle converting it to a session cookie [5](https://github.com/better-auth/better-auth/blob/84c5f563af9a019ae33138ff612646e1d760abdb/packages/better-auth/src/plugins/bearer/index.ts). 5. If you need to forward cookies from a proxy or server action, forward the entire cookie header as-is to the backend session endpoint [6](https://github.com/better-auth/better-auth/issues/4188). If you follow these steps and use the correct cookie name and signing, `auth.api.getSession({ headers })` should return a valid session. If it still returns null, double-check your cookie config and try upgrading to the latest Better Auth version in case you are hitting a known bug [2](https://github.com/better-auth/better-auth/issues/4517). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ee8903ce-0580-4e85-bbb9-99e14d083819?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ee8903ce-0580-4e85-bbb9-99e14d083819?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ee8903ce-0580-4e85-bbb9-99e14d083819?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ee8903ce-0580-4e85-bbb9-99e14d083819?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ee8903ce-0580-4e85-bbb9-99e14d083819?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ee8903ce-0580-4e85-bbb9-99e14d083819?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ee8903ce-0580-4e85-bbb9-99e14d083819?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&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/4555)
Author
Owner

@xkalf commented on GitHub (Sep 10, 2025):

@dosu
i tried all of that client and server is different computer client is on 192.168.0.170:3000 but still not working

@xkalf commented on GitHub (Sep 10, 2025): @dosu i tried all of that client and server is different computer client is on 192.168.0.170:3000 but still not working
Author
Owner

@dosubot[bot] commented on GitHub (Sep 10, 2025):

When the client and server are on different computers, session retrieval often fails because of strict browser rules for cross-origin cookies. Here are the most common causes and fixes:

  1. Cookie attributes: For cross-origin cookies, you must set sameSite: "none" and secure: true in your Better Auth config. Your current config has secure: false, which will cause browsers to block the cookie unless you’re using HTTP on both sides (and even then, some browsers will still block it) see details.
  2. HTTPS requirement: If you set secure: true, your backend must be served over HTTPS. Browsers will silently drop cookies with the Secure flag if sent over HTTP see docs.
  3. Cookie name and signing: Better Auth expects a cookie named better-auth.session_token or __Secure-better-auth.session_token, not accessToken. The cookie must be signed and encoded using Better Auth’s helpers, not set manually see docs.
  4. CORS and credentials: Your fetch requests must use credentials: "include", and your backend CORS config must allow credentials and the correct origin see docs.
  5. Proxy/middleware: If you use a proxy or custom middleware, make sure it forwards all cookie headers unmodified see docs.

Next steps:

  • Update your Better Auth config to secure: true and run your backend over HTTPS.
  • Inspect the browser’s network tab after login: check the Set-Cookie header from the server and confirm the cookie name, attributes, and value.
  • Make sure the cookie is present in requests from the client to the server.
  • If you’re still stuck, share the exact Set-Cookie header sent by your server after login and any browser warnings/errors about cookies.

If you need to support development over HTTP, set sameSite: "lax" and secure: false, but this will only work on localhost—not across LAN IPs in most browsers see docs.

Let me know what you find in the network tab or if you have a sample Set-Cookie header!

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 10, 2025): <!-- Answer --> When the client and server are on different computers, session retrieval often fails because of strict browser rules for cross-origin cookies. Here are the most common causes and fixes: 1. **Cookie attributes:** For cross-origin cookies, you must set `sameSite: "none"` and `secure: true` in your Better Auth config. Your current config has `secure: false`, which will cause browsers to block the cookie unless you’re using HTTP on both sides (and even then, some browsers will still block it) [see details](https://github.com/better-auth/better-auth/issues/935#issuecomment-2556179496). 2. **HTTPS requirement:** If you set `secure: true`, your backend must be served over HTTPS. Browsers will silently drop cookies with the Secure flag if sent over HTTP [see docs](https://github.com/better-auth/better-auth/issues/935#issuecomment-2556179496). 3. **Cookie name and signing:** Better Auth expects a cookie named `better-auth.session_token` or `__Secure-better-auth.session_token`, not `accessToken`. The cookie must be signed and encoded using Better Auth’s helpers, not set manually [see docs](https://github.com/better-auth/better-auth/issues/4517). 4. **CORS and credentials:** Your fetch requests must use `credentials: "include"`, and your backend CORS config must allow credentials and the correct origin [see docs](https://github.com/better-auth/better-auth/issues/4188). 5. **Proxy/middleware:** If you use a proxy or custom middleware, make sure it forwards all cookie headers unmodified [see docs](https://github.com/better-auth/better-auth/issues/4188). **Next steps:** - Update your Better Auth config to `secure: true` and run your backend over HTTPS. - Inspect the browser’s network tab after login: check the Set-Cookie header from the server and confirm the cookie name, attributes, and value. - Make sure the cookie is present in requests from the client to the server. - If you’re still stuck, share the exact Set-Cookie header sent by your server after login and any browser warnings/errors about cookies. If you need to support development over HTTP, set `sameSite: "lax"` and `secure: false`, but this will only work on localhost—not across LAN IPs in most browsers [see docs](https://github.com/better-auth/better-auth/discussions/3262#discussioncomment-13666476). Let me know what you find in the network tab or if you have a sample Set-Cookie header! <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/bfa3e19b-4c2b-4d32-bf72-faa6b1973ecf?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bfa3e19b-4c2b-4d32-bf72-faa6b1973ecf?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bfa3e19b-4c2b-4d32-bf72-faa6b1973ecf?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bfa3e19b-4c2b-4d32-bf72-faa6b1973ecf?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bfa3e19b-4c2b-4d32-bf72-faa6b1973ecf?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bfa3e19b-4c2b-4d32-bf72-faa6b1973ecf?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bfa3e19b-4c2b-4d32-bf72-faa6b1973ecf?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&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/4555)
Author
Owner

@xkalf commented on GitHub (Sep 10, 2025):

@dosu

  1. I set better auth config secure: true
  2. Here is the Set-Cookie header better-auth.session_token=9c0rwhRaP2RF411ZchDsgvOXiHAxV6FC.PV5sOuijq1Hw6S8Ipg5uaIDwj7BcTNHl7%2Be3ZXYQOUA%3D; Max-Age=604800; Path=/; HttpOnly; Secure; SameSite=None
  3. client have credentials: true
@xkalf commented on GitHub (Sep 10, 2025): @dosu 1. I set better auth config secure: true 2. Here is the Set-Cookie header better-auth.session_token=9c0rwhRaP2RF411ZchDsgvOXiHAxV6FC.PV5sOuijq1Hw6S8Ipg5uaIDwj7BcTNHl7%2Be3ZXYQOUA%3D; Max-Age=604800; Path=/; HttpOnly; Secure; SameSite=None 3. client have credentials: true
Author
Owner

@dosubot[bot] commented on GitHub (Sep 10, 2025):

With secure: true and SameSite=None, browsers will only send your session cookie if your backend is served over HTTPS. If your backend is running on plain HTTP, the browser will silently block the cookie—even though the Set-Cookie header looks correct—so auth.api.getSession({ headers }) will always return null in cross-origin setups see code.

Please check these:

  • Is your backend running on HTTPS? If not, switch to HTTPS or set secure: false for local development (but this won't work reliably across LAN IPs).
  • Open your browser's network tab after login and inspect requests to your backend. Is the better-auth.session_token cookie present in the request headers? If not, the browser is blocking it.
  • Look for any browser warnings about blocked cookies or "This cookie was not sent because it had the 'Secure' attribute and was not sent over HTTPS".

If you confirm the backend is on HTTPS and the cookie is present in requests, but sessions are still null, let me know what you see in the network tab and any browser warnings. If you’re on HTTP, that’s the root cause—Secure cookies require HTTPS see docs.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 10, 2025): <!-- Answer --> With `secure: true` and `SameSite=None`, browsers will only send your session cookie if your backend is served over HTTPS. If your backend is running on plain HTTP, the browser will silently block the cookie—even though the Set-Cookie header looks correct—so `auth.api.getSession({ headers })` will always return null in cross-origin setups [see code](https://github.com/better-auth/better-auth/blob/84c5f563af9a019ae33138ff612646e1d760abdb/packages/better-auth/src/cookies/index.ts). Please check these: - Is your backend running on HTTPS? If not, switch to HTTPS or set `secure: false` for local development (but this won't work reliably across LAN IPs). - Open your browser's network tab after login and inspect requests to your backend. Is the `better-auth.session_token` cookie present in the request headers? If not, the browser is blocking it. - Look for any browser warnings about blocked cookies or "This cookie was not sent because it had the 'Secure' attribute and was not sent over HTTPS". If you confirm the backend is on HTTPS and the cookie is present in requests, but sessions are still null, let me know what you see in the network tab and any browser warnings. If you’re on HTTP, that’s the root cause—Secure cookies require HTTPS [see docs](https://github.com/better-auth/better-auth/issues/3470#issuecomment-3092460530). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/8fd17668-0eb1-4a14-84fa-9e258f967380?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8fd17668-0eb1-4a14-84fa-9e258f967380?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8fd17668-0eb1-4a14-84fa-9e258f967380?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8fd17668-0eb1-4a14-84fa-9e258f967380?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8fd17668-0eb1-4a14-84fa-9e258f967380?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/8fd17668-0eb1-4a14-84fa-9e258f967380?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8fd17668-0eb1-4a14-84fa-9e258f967380?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&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/4555)
Author
Owner

@frectonz commented on GitHub (Sep 10, 2025):

@xkalf like dosubot said i don't think this this a bug in better auth. Refer to the Set-Cookie docs here. You can use a tunnel like ngrok to set up an https endpoint for your local server.

Let me know if you are still facing a problem.

@frectonz commented on GitHub (Sep 10, 2025): @xkalf like `dosubot` said i don't think this this a bug in better auth. Refer to the `Set-Cookie` docs [here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie#secure). You can use a tunnel like `ngrok` to set up an `https` endpoint for your local server. Let me know if you are still facing a problem.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1893