[GH-ISSUE #3613] ESM/CJS incompatibility: better-auth CJS build fails requiring nanostores #9662

Closed
opened 2026-04-13 05:16:28 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @aymericzip on GitHub (Jul 25, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/3613

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

When using better-auth v1.3.3 in a monorepo with pnpm, any CommonJS consumers crash with:

Error [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module /Users/user/Documents/intlayer/node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/index.js in a cycle. (from /Users/aymericpineau/Documents/intlayer/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/better-auth/dist/shared/better-auth.C3JMOQZ3.cjs) "node:internal/modules/esm/loader:309\n        throw new ERR_REQUIRE_CYCLE_MODULE(message);\n        ^\n\nError [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module /Users/user/Documents/intlayer/node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/index.js in a cycle. (from /Users/aymericpineau/Documents/intlayer/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/better-auth/dist/shared/better-auth.C3JMOQZ3.cjs)\n    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:309:15)\n    at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24)\n    at Module._compile (node:internal/modules/cjs/loader:1511:5)\n    at Module._extensions..js (node:internal/modules/cjs/loader:1572:16)\n    at Module.load (node:internal/modules/cjs/loader:1275:32)\n    at Module._load (node:internal/modules/cjs/loader:1096:12)\n    at Module.require (node:internal/modules/cjs/loader:1298:19)\n    at require (node:internal/modules/helpers:182:18)\n    at Object.<anonymous> (/Users/user/Documents/intlayer/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/better-auth/dist/shared/better-auth.C3JMOQZ3.cjs:5:20)\n    at Module._compile (node:internal/modules/cjs/loader:1529:14)"

because the shipped CJS bundle of better‑auth still tries to require('nanostores'), which is now only published as an ESM entry.

Steps to Reproduce

Run any CJS script that does const auth = require('better-auth').

Expected Behavior
CommonJS imports of better-auth should work without error, even though nanostores is ESM-only.

Actual Behavior
Node throws ERR_REQUIRE_CYCLE_MODULE, blocking any CJS usage of the library.

Environment

  • MacOS
  • Node v20.19.0
  • pnpm monorepo
  • better-auth 1.3.3
  • nanostores 0.11.4

Possible Fixes

  • Bundle nanostores into the CJS build of better‑auth (i.e. remove it from externals at packages/better-auth/build.config.ts).

Let me know if you need more detail

Current vs. Expected behavior

What version of Better Auth are you using?

1.3.3

Provide environment information

-

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

Package

Auth config (if applicable)

import type { OrganizationAPI } from '@/types/organization.types';
import type { ProjectAPI } from '@/types/project.types';
import type {
  SessionAPI,
  SessionContext,
  SessionDataApi,
} from '@/types/session.types';
import type { User, UserAPI } from '@/types/user.types';
import { sendVerificationUpdate } from '@controllers/user.controller';
import { logger } from '@logger';
import { sendEmail } from '@services/email.service';
import { getOrganizationById } from '@services/organization.service';
import { getProjectById } from '@services/project.service';
import { getUserById } from '@services/user.service';
import { mapOrganizationToAPI } from '@utils/mapper/organization';
import { mapProjectToAPI } from '@utils/mapper/project';
import { mapUserToAPI } from '@utils/mapper/user';
import {
  computeEffectivePermission,
  getSessionRoles,
  intersectPermissions,
} from '@utils/permissions';
import { betterAuth, OmitId } from 'better-auth';
import { mongodbAdapter } from 'better-auth/adapters/mongodb';
import { createAuthMiddleware } from 'better-auth/api';
import { customSession } from 'better-auth/plugins';
import type { MongoClient } from 'mongodb';

export type Auth = ReturnType<typeof betterAuth>;

export const formatSession = (session: SessionContext): OmitId<SessionAPI> => {
  const roles = getSessionRoles(session);
  let permissions = computeEffectivePermission(roles);

  // Intersect in the case a Access Token try to override the permissions
  if (session.permissions) {
    permissions = intersectPermissions(permissions, session.permissions);
  }

  const resultSession = {
    user: mapUserToAPI(session.user),
    organization: mapOrganizationToAPI(session.organization),
    project: mapProjectToAPI(session.project),
    authType: 'session',
    permissions,
    roles,
  } as OmitId<SessionAPI>;

  return resultSession;
};

export const getAuth = (dbClient: MongoClient): Auth => {
  if (!dbClient) {
    throw new Error('MongoDB connection not established');
  }

  const auth = betterAuth({
    appName: 'Intlayer',

    database: mongodbAdapter(dbClient.db()),

    /**
     * User model
     */
    user: {
      modelName: 'users',
    },

    databaseHooks: {
      user: {
        create: {
          // Runs once, immediately after the INSERT
          after: async (user) => {
            if (!user?.emailVerified) return;

            await sendEmail({
              type: 'welcome',
              to: user.email,
              username: user.name ?? user.email.split('@')[0],
              loginLink: `${process.env.CLIENT_URL}/auth/login`,
              locale: (user as any).lang,
            });
            logger.info('Welcome e‑mail delivered', {
              email: user.email,
            });
          },
        },
      },
    },

    hooks: {
      after: createAuthMiddleware(async (ctx) => {
        const { path, context } = ctx;

        const newUser = context.newSession?.user;
        const existingUser = context.session?.user;
        const user = newUser ?? existingUser;

        if (!user) return;

        if (['/verify-email'].includes(path)) {
          sendVerificationUpdate(user as unknown as User);
          logger.info('SSE verification update sent', {
            email: user.email,
            userId: user.id,
          });

          await sendEmail({
            type: 'welcome',
            to: user.email,
            username: user.name ?? user.email.split('@')[0],
            loginLink: `${process.env.CLIENT_URL}/auth/login`,
            locale: (user as any).lang,
          });
          logger.info('Welcome e‑mail delivered', {
            email: user.email,
          });
        }
      }),
    },

    advanced: {
      // 1️⃣  Change or drop the global prefix
      // cookiePrefix: "intlayer",          // =>  intlayer.session_token
      cookiePrefix: 'intlayer', // =>  session_token  (no prefix)

      // 2️⃣  Override just the session‑token cookie
      cookies: {
        session_token: {
          // name: 'intlayer_session_token', // final name depends on the prefix above
          // attributes: { sameSite: "lax", maxAge: 60 * 60 * 24 } // optional
        },
      },

      // 3️⃣  (optional) turn off the automatic __Secure‑ prefix in non‑prod
      // useSecureCookies: false,
    },

    session: {
      modelName: 'sessions',
      id: 'id',

      additionalFields: {
        activeOrganizationId: { type: 'string', nullable: true, input: false },
        activeProjectId: { type: 'string', nullable: true, input: false },
      },
    },

    plugins: [
      customSession(async ({ session }) => {
        const typedSession = session as unknown as SessionDataApi;

        let userAPI: UserAPI | null = null;
        let organizationAPI: OrganizationAPI | null = null;
        let projectAPI: ProjectAPI | null = null;

        if (typedSession.userId) {
          const userData = await getUserById(typedSession.userId);

          if (userData) {
            userAPI = mapUserToAPI(userData);
          }
        }

        if (typedSession.activeOrganizationId) {
          const orgData = await getOrganizationById(
            typedSession.activeOrganizationId
          );

          if (orgData) {
            organizationAPI = mapOrganizationToAPI(orgData);
          }
        }
        if (typedSession.activeProjectId) {
          const projectData = await getProjectById(
            typedSession.activeProjectId
          );

          if (projectData) {
            projectAPI = mapProjectToAPI(projectData);
          }
        }

        const sessionWithNoPermission: SessionContext = {
          session: typedSession,
          user: userAPI!,
          organization: organizationAPI ?? null,
          project: projectAPI ?? null,
          authType: 'session',
        };

        return formatSession(sessionWithNoPermission);
      }),
    ],

    emailAndPassword: {
      enabled: true,
      disableSignUp: false,
      requireEmailVerification: true,
      minPasswordLength: 8,
      maxPasswordLength: 128,
      autoSignIn: true,
      sendResetPassword: async ({ user, url }) => {
        logger.info('sending reset password email', { email: user.email });
        await sendEmail({
          type: 'resetPassword',
          to: user.email,
          username: user.name ?? user.email.split('@')[0],
          resetLink: url,
        });
      },
      resetPasswordTokenExpiresIn: 3600,
    },
    accountLinking: {
      enabled: true, // allow linking in general
      trustedProviders: ['google', 'github'], // optional: auto‑link when Google verifies the e‑mail
    },
    emailVerification: {
      autoSignInAfterVerification: true,
      sendVerificationEmail: async ({ user, url }) => {
        logger.info('sending verification email', { email: user.email });
        await sendEmail({
          type: 'validate',
          to: user.email,
          username: user.name ?? user.email.split('@')[0],
          validationLink: url,
        });
      },
    },

    crossSubDomainCookies: {
      enabled: true,
      additionalCookies: ['session_token'],
      domain: process.env.CLIENT_URL as string,
    },
    cookiePrefix: 'intlayer',
    cookies: {
      session_token: {
        name: 'session_token',
        attributes: {
          httpOnly: true,
          secure: true,
        },
      },
    },

    trustedOrigins: [process.env.CLIENT_URL as string],

    socialProviders: {
      google: {
        clientId: process.env.GOOGLE_CLIENT_ID as string,
        clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
      },
      github: {
        clientId: process.env.GITHUB_CLIENT_ID as string,
        clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
      },
    },

    logger: {
      log: (level, message, ...args) => logger[level](message, ...args),
    },
  });

  return auth;
};

Additional context

Dependency graph:
intlayer command > @intlayer/cli > @intlayer/api > @intlayer/backend > better-auth > nanostore

@intlayer/api import backend as devDep to reuse the API types

Originally created by @aymericzip on GitHub (Jul 25, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/3613 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce When using **better-auth** v1.3.3 in a monorepo with pnpm, any CommonJS consumers crash with: ``` Error [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module /Users/user/Documents/intlayer/node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/index.js in a cycle. (from /Users/aymericpineau/Documents/intlayer/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/better-auth/dist/shared/better-auth.C3JMOQZ3.cjs) "node:internal/modules/esm/loader:309\n throw new ERR_REQUIRE_CYCLE_MODULE(message);\n ^\n\nError [ERR_REQUIRE_CYCLE_MODULE]: Cannot require() ES Module /Users/user/Documents/intlayer/node_modules/.pnpm/nanostores@0.11.4/node_modules/nanostores/index.js in a cycle. (from /Users/aymericpineau/Documents/intlayer/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/better-auth/dist/shared/better-auth.C3JMOQZ3.cjs)\n at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:309:15)\n at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24)\n at Module._compile (node:internal/modules/cjs/loader:1511:5)\n at Module._extensions..js (node:internal/modules/cjs/loader:1572:16)\n at Module.load (node:internal/modules/cjs/loader:1275:32)\n at Module._load (node:internal/modules/cjs/loader:1096:12)\n at Module.require (node:internal/modules/cjs/loader:1298:19)\n at require (node:internal/modules/helpers:182:18)\n at Object.<anonymous> (/Users/user/Documents/intlayer/node_modules/.pnpm/better-auth@1.3.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/better-auth/dist/shared/better-auth.C3JMOQZ3.cjs:5:20)\n at Module._compile (node:internal/modules/cjs/loader:1529:14)" ``` because the shipped CJS bundle of **better‑auth** still tries to `require('nanostores')`, which is now only published as an ESM entry. **Steps to Reproduce** Run any CJS script that does `const auth = require('better-auth')`. **Expected Behavior** CommonJS imports of **better-auth** should work without error, even though **nanostores** is ESM-only. **Actual Behavior** Node throws `ERR_REQUIRE_CYCLE_MODULE`, blocking any CJS usage of the library. **Environment** * MacOS * Node v20.19.0 * pnpm monorepo * better-auth 1.3.3 * nanostores 0.11.4 **Possible Fixes** * **Bundle nanostores** into the CJS build of **better‑auth** (i.e. remove it from externals at `packages/better-auth/build.config.ts`). Let me know if you need more detail ### Current vs. Expected behavior - ### What version of Better Auth are you using? 1.3.3 ### Provide environment information ```bash - ``` ### Which area(s) are affected? (Select all that apply) Package ### Auth config (if applicable) ```typescript import type { OrganizationAPI } from '@/types/organization.types'; import type { ProjectAPI } from '@/types/project.types'; import type { SessionAPI, SessionContext, SessionDataApi, } from '@/types/session.types'; import type { User, UserAPI } from '@/types/user.types'; import { sendVerificationUpdate } from '@controllers/user.controller'; import { logger } from '@logger'; import { sendEmail } from '@services/email.service'; import { getOrganizationById } from '@services/organization.service'; import { getProjectById } from '@services/project.service'; import { getUserById } from '@services/user.service'; import { mapOrganizationToAPI } from '@utils/mapper/organization'; import { mapProjectToAPI } from '@utils/mapper/project'; import { mapUserToAPI } from '@utils/mapper/user'; import { computeEffectivePermission, getSessionRoles, intersectPermissions, } from '@utils/permissions'; import { betterAuth, OmitId } from 'better-auth'; import { mongodbAdapter } from 'better-auth/adapters/mongodb'; import { createAuthMiddleware } from 'better-auth/api'; import { customSession } from 'better-auth/plugins'; import type { MongoClient } from 'mongodb'; export type Auth = ReturnType<typeof betterAuth>; export const formatSession = (session: SessionContext): OmitId<SessionAPI> => { const roles = getSessionRoles(session); let permissions = computeEffectivePermission(roles); // Intersect in the case a Access Token try to override the permissions if (session.permissions) { permissions = intersectPermissions(permissions, session.permissions); } const resultSession = { user: mapUserToAPI(session.user), organization: mapOrganizationToAPI(session.organization), project: mapProjectToAPI(session.project), authType: 'session', permissions, roles, } as OmitId<SessionAPI>; return resultSession; }; export const getAuth = (dbClient: MongoClient): Auth => { if (!dbClient) { throw new Error('MongoDB connection not established'); } const auth = betterAuth({ appName: 'Intlayer', database: mongodbAdapter(dbClient.db()), /** * User model */ user: { modelName: 'users', }, databaseHooks: { user: { create: { // Runs once, immediately after the INSERT after: async (user) => { if (!user?.emailVerified) return; await sendEmail({ type: 'welcome', to: user.email, username: user.name ?? user.email.split('@')[0], loginLink: `${process.env.CLIENT_URL}/auth/login`, locale: (user as any).lang, }); logger.info('Welcome e‑mail delivered', { email: user.email, }); }, }, }, }, hooks: { after: createAuthMiddleware(async (ctx) => { const { path, context } = ctx; const newUser = context.newSession?.user; const existingUser = context.session?.user; const user = newUser ?? existingUser; if (!user) return; if (['/verify-email'].includes(path)) { sendVerificationUpdate(user as unknown as User); logger.info('SSE verification update sent', { email: user.email, userId: user.id, }); await sendEmail({ type: 'welcome', to: user.email, username: user.name ?? user.email.split('@')[0], loginLink: `${process.env.CLIENT_URL}/auth/login`, locale: (user as any).lang, }); logger.info('Welcome e‑mail delivered', { email: user.email, }); } }), }, advanced: { // 1️⃣ Change or drop the global prefix // cookiePrefix: "intlayer", // => intlayer.session_token cookiePrefix: 'intlayer', // => session_token (no prefix) // 2️⃣ Override just the session‑token cookie cookies: { session_token: { // name: 'intlayer_session_token', // final name depends on the prefix above // attributes: { sameSite: "lax", maxAge: 60 * 60 * 24 } // optional }, }, // 3️⃣ (optional) turn off the automatic __Secure‑ prefix in non‑prod // useSecureCookies: false, }, session: { modelName: 'sessions', id: 'id', additionalFields: { activeOrganizationId: { type: 'string', nullable: true, input: false }, activeProjectId: { type: 'string', nullable: true, input: false }, }, }, plugins: [ customSession(async ({ session }) => { const typedSession = session as unknown as SessionDataApi; let userAPI: UserAPI | null = null; let organizationAPI: OrganizationAPI | null = null; let projectAPI: ProjectAPI | null = null; if (typedSession.userId) { const userData = await getUserById(typedSession.userId); if (userData) { userAPI = mapUserToAPI(userData); } } if (typedSession.activeOrganizationId) { const orgData = await getOrganizationById( typedSession.activeOrganizationId ); if (orgData) { organizationAPI = mapOrganizationToAPI(orgData); } } if (typedSession.activeProjectId) { const projectData = await getProjectById( typedSession.activeProjectId ); if (projectData) { projectAPI = mapProjectToAPI(projectData); } } const sessionWithNoPermission: SessionContext = { session: typedSession, user: userAPI!, organization: organizationAPI ?? null, project: projectAPI ?? null, authType: 'session', }; return formatSession(sessionWithNoPermission); }), ], emailAndPassword: { enabled: true, disableSignUp: false, requireEmailVerification: true, minPasswordLength: 8, maxPasswordLength: 128, autoSignIn: true, sendResetPassword: async ({ user, url }) => { logger.info('sending reset password email', { email: user.email }); await sendEmail({ type: 'resetPassword', to: user.email, username: user.name ?? user.email.split('@')[0], resetLink: url, }); }, resetPasswordTokenExpiresIn: 3600, }, accountLinking: { enabled: true, // allow linking in general trustedProviders: ['google', 'github'], // optional: auto‑link when Google verifies the e‑mail }, emailVerification: { autoSignInAfterVerification: true, sendVerificationEmail: async ({ user, url }) => { logger.info('sending verification email', { email: user.email }); await sendEmail({ type: 'validate', to: user.email, username: user.name ?? user.email.split('@')[0], validationLink: url, }); }, }, crossSubDomainCookies: { enabled: true, additionalCookies: ['session_token'], domain: process.env.CLIENT_URL as string, }, cookiePrefix: 'intlayer', cookies: { session_token: { name: 'session_token', attributes: { httpOnly: true, secure: true, }, }, }, trustedOrigins: [process.env.CLIENT_URL as string], socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID as string, clientSecret: process.env.GOOGLE_CLIENT_SECRET as string, }, github: { clientId: process.env.GITHUB_CLIENT_ID as string, clientSecret: process.env.GITHUB_CLIENT_SECRET as string, }, }, logger: { log: (level, message, ...args) => logger[level](message, ...args), }, }); return auth; }; ``` ### Additional context Dependency graph: intlayer command > @intlayer/cli > @intlayer/api > @intlayer/backend > better-auth > nanostore @intlayer/api import backend as devDep to reuse the API types
GiteaMirror added the lockedbug labels 2026-04-13 05:16:28 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 25, 2025):

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

This is a known issue: better-auth’s CJS build externalizes nanostores, which is now ESM-only, so any CJS consumer that tries to require('better-auth') will hit a runtime error because Node can’t require ESM modules from CJS (details). The build config explicitly lists nanostores as an external in the CJS build, which is the root cause (build config).

There’s no official workaround for CJS projects—Better Auth’s maintainers recommend using ESM by setting "type": "module" in your package.json (PR #1045). If you need CJS compatibility, your suggestion to bundle nanostores (i.e., remove it from externals in the build config) is technically feasible and would likely resolve the error, but this isn’t the current default.

A similar situation with nanoid led to replacing it with a dual-compatible library for better CJS/ESM support (PR #550). Unless the maintainers change the build to bundle nanostores or swap it for a dual-compatible alternative, CJS support will remain broken.

For now, the only robust path is to migrate your project to ESM. If you must stick with CJS, you could try forking better-auth and adjusting the build config to bundle nanostores, but this isn’t officially supported.

To reply, just mention @dosu.


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

<!-- gh-comment-id:3119600739 --> @dosubot[bot] commented on GitHub (Jul 25, 2025): <!-- Greeting --> Hi @aymericzip! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> This is a known issue: better-auth’s CJS build externalizes nanostores, which is now ESM-only, so any CJS consumer that tries to require('better-auth') will hit a runtime error because Node can’t require ESM modules from CJS ([details](https://github.com/better-auth/better-auth/issues/3369)). The build config explicitly lists nanostores as an external in the CJS build, which is the root cause ([build config](https://github.com/better-auth/better-auth/blob/f99305b29eb096186a0f85100e01f721d208f2f0/packages/better-auth/build.config.ts)). There’s no official workaround for CJS projects—Better Auth’s maintainers recommend using ESM by setting `"type": "module"` in your package.json ([PR #1045](https://github.com/better-auth/better-auth/pull/1045)). If you need CJS compatibility, your suggestion to bundle nanostores (i.e., remove it from externals in the build config) is technically feasible and would likely resolve the error, but this isn’t the current default. A similar situation with nanoid led to replacing it with a dual-compatible library for better CJS/ESM support ([PR #550](https://github.com/better-auth/better-auth/pull/550)). Unless the maintainers change the build to bundle nanostores or swap it for a dual-compatible alternative, CJS support will remain broken. For now, the only robust path is to migrate your project to ESM. If you must stick with CJS, you could try forking better-auth and adjusting the build config to bundle nanostores, but this isn’t officially supported. <!-- 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/8531142b-0736-45e3-9c05-5f1fcfcf0209?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/8531142b-0736-45e3-9c05-5f1fcfcf0209?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/8531142b-0736-45e3-9c05-5f1fcfcf0209?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/8531142b-0736-45e3-9c05-5f1fcfcf0209?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/8531142b-0736-45e3-9c05-5f1fcfcf0209?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/8531142b-0736-45e3-9c05-5f1fcfcf0209?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/8531142b-0736-45e3-9c05-5f1fcfcf0209?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/3613)
Author
Owner

@aymericzip commented on GitHub (Jul 25, 2025):

closing as duplicate of https://github.com/better-auth/better-auth/issues/3568

<!-- gh-comment-id:3120132974 --> @aymericzip commented on GitHub (Jul 25, 2025): closing as duplicate of https://github.com/better-auth/better-auth/issues/3568
Author
Owner

@aymericzip commented on GitHub (Jul 26, 2025):

Fixed by adding

  "pnpm": {
    "overrides": {
      "nanostores": "npm:nanostores-cjs@0.7.1",
    }
  },

In my package.json config

<!-- gh-comment-id:3123375720 --> @aymericzip commented on GitHub (Jul 26, 2025): Fixed by adding ```json "pnpm": { "overrides": { "nanostores": "npm:nanostores-cjs@0.7.1", } }, ``` In my package.json config
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9662