[GH-ISSUE #1473] nextjs project doesn't build with 1.1.18 #26097

Closed
opened 2026-04-17 16:32:06 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @bmichotte on GitHub (Feb 17, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1473

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Using the following package.json

package.json
{
   "name": "my-project",
   "version": "0.1.0",
   "private": true,
   "scripts": {
       "dev": "next dev --turbopack",
       "build": "next build"
   },
   "prisma": {
       "seed": "bun run prisma/seed.ts"
   },
   "dependencies": {
       "@ai-sdk/mistral": "^1.1.11",
       "@ai-sdk/openai": "^1.1.12",
       "@ai-sdk/react": "^1.1.16",
       "@fortawesome/fontawesome-svg-core": "^6.7.2",
       "@fortawesome/free-brands-svg-icons": "^6.7.2",
       "@fortawesome/pro-regular-svg-icons": "^6.7.2",
       "@fortawesome/pro-solid-svg-icons": "^6.7.2",
       "@fortawesome/pro-thin-svg-icons": "^6.7.2",
       "@fortawesome/react-fontawesome": "^0.2.2",
       "@gsap/react": "^2.1.2",
       "@hookform/resolvers": "^4.1.0",
       "@langchain/core": "^0.3.40",
       "@langchain/langgraph": "^0.2.46",
       "@langchain/openai": "^0.4.4",
       "@mdxeditor/editor": "^3.23.0",
       "@next/third-parties": "^15.1.7",
       "@paralleldrive/cuid2": "^2.2.2",
       "@prisma/client": "^6.3.1",
       "@radix-ui/react-accordion": "^1.2.3",
       "@radix-ui/react-alert-dialog": "^1.1.6",
       "@radix-ui/react-avatar": "^1.1.3",
       "@radix-ui/react-checkbox": "^1.1.4",
       "@radix-ui/react-context-menu": "^2.2.6",
       "@radix-ui/react-dialog": "^1.1.6",
       "@radix-ui/react-dropdown-menu": "^2.1.6",
       "@radix-ui/react-label": "^2.1.2",
       "@radix-ui/react-popover": "^1.1.6",
       "@radix-ui/react-radio-group": "^1.2.3",
       "@radix-ui/react-scroll-area": "^1.2.3",
       "@radix-ui/react-select": "^2.1.6",
       "@radix-ui/react-separator": "^1.1.2",
       "@radix-ui/react-slot": "^1.1.2",
       "@radix-ui/react-switch": "^1.1.3",
       "@radix-ui/react-tabs": "^1.1.3",
       "@radix-ui/react-toggle": "^1.1.2",
       "@radix-ui/react-toggle-group": "^1.1.2",
       "@radix-ui/react-tooltip": "^1.1.8",
       "@radix-ui/react-visually-hidden": "^1.1.2",
       "@sentry/nextjs": "^9.1.0",
       "@tanstack/react-table": "^8.21.2",
       "@uiw/react-json-view": "^2.0.0-alpha.30",
       "@vis.gl/react-google-maps": "^1.5.1",
       "ai": "^4.1.41",
       "air-datepicker": "^3.5.3",
       "better-auth": "1.1.17",
       "boring-avatars": "^1.11.2",
       "class-variance-authority": "^0.7.1",
       "clsx": "^2.1.1",
       "cmdk": "1.0.4",
       "date-fns": "^4.1.0",
       "discord.js": "^14.18.0",
       "embla-carousel-react": "^8.5.2",
       "flat": "^6.0.1",
       "framer-motion": "^12.4.3",
       "i18n-iso-countries": "^7.13.0",
       "jodit-react": "^5.2.14",
       "jwt-decode": "^4.0.0",
       "lucide-react": "^0.475.0",
       "my-ua-parser": "^2.0.4",
       "next": "^15.1.7",
       "next-intl": "^3.26.3",
       "next-themes": "^0.4.4",
       "nodemailer": "^6.10.0",
       "pgvector": "^0.2.0",
       "qs": "^6.14.0",
       "react": "^19.0.0",
       "react-dom": "^19.0.0",
       "react-dropzone": "^14.3.5",
       "react-hook-form": "^7.54.2",
       "react-image-crop": "^11.0.7",
       "react-markdown": "^9.0.3",
       "rimraf": "^6.0.1",
       "server-only": "^0.0.1",
       "sharp": "^0.33.5",
       "slug": "^10.0.0",
       "sonner": "^1.7.4",
       "superjson": "^2.2.2",
       "tailwind-merge": "^3.0.1",
       "tailwindcss-animate": "^1.0.7",
       "tiktoken": "^1.0.20",
       "use-deep-compare-effect": "^1.8.1",
       "use-stick-to-bottom": "^1.0.46",
       "usehooks-ts": "^3.1.1",
       "vanilla-cookieconsent": "^3.1.0",
       "zod": "^3.24.2"
   },
   "devDependencies": {
       "@biomejs/biome": "^1.9.4",
       "@tailwindcss/postcss": "^4.0.6",
       "@tailwindcss/typography": "^0.5.16",
       "@types/bun": "^1.2.2",
       "@types/google.maps": "^3.58.1",
       "@types/node": "^22.13.4",
       "@types/nodemailer": "^6.4.17",
       "@types/prompts": "^2.4.9",
       "@types/qs": "^6.9.18",
       "@types/react": "^19.0.10",
       "@types/react-dom": "^19.0.4",
       "@types/slug": "^5.0.9",
       "deepl-node": "^1.16.0",
       "dotenv": "^16.4.7",
       "dotenv-cli": "^8.0.0",
       "husky": "^9.1.7",
       "ora": "^8.2.0",
       "postcss": "^8.5.2",
       "prisma": "^6.3.1",
       "prompts": "^2.4.2",
       "tailwindcss": "^4.0.6",
       "typescript": "^5.7.3"
   }
}

I also added my bun.lock to be able to "bun install" the exact versions

My project build without any issue.

If I update better-auth to 1.1.18, I have the following crash

Image

Image

I tried to update to 1.1.18-beta.1 to find the "range" of commits, but it crashed also.
Also tried 1.1.19-beta.2 without any luck either

I can build 1.2.0-beta.9 (but I haven't tested it to see if my application still works)

Current vs. Expected behavior

1.1.17 build, 1.1.18+ crashes

What version of Better Auth are you using?

1.1.18

Provide environment information

tested on
- macOS 15.3 node 22.14.0
- Ubuntu 22.10 node 20.16.0

using 
- bun 1.2.0
- also tested with 9.12.2

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

Package, Other

Auth config

// auth.ts
import { betterAuth } from 'better-auth'
import { prismaAdapter } from 'better-auth/adapters/prisma'
import { prisma } from '@/lib/prisma'
import { nextCookies } from 'better-auth/next-js'
import { admin } from 'better-auth/plugins'
import { routing, type Locale } from '@/i18n/routing'
import { env } from '@/lib/env'
import { send } from '@/lib/emails'

export const auth = betterAuth({
    database: prismaAdapter(prisma, {
        provider: 'postgresql',
    }),
    trustedOrigins: [env.BETTER_AUTH_URL],
    emailAndPassword: {
        enabled: true,
        sendResetPassword: async ({ user, url, token }, request) => {
            await send(
                'forgot_password',
                {
                    url,
                },
                (user as unknown as { locale: Locale }).locale,
                { address: user.email, displayName: user.name }
            )
        },
    },
    socialProviders: {
        google: {
            clientId: env.GOOGLE_CLIENT_ID,
            clientSecret: env.GOOGLE_CLIENT_SECRET,
        },
        microsoft: {
            clientId: env.MICROSOFT_CLIENT_ID,
            clientSecret: env.MICROSOFT_CLIENT_SECRET,
            tenantId: env.MICROSOFT_CLIENT_TENANT_ID,
        },
    },
    plugins: [nextCookies(), admin()],
    user: {
        modelName: 'User',
        additionalFields: {
            role: {
                type: 'string',
                required: false,
                defaultValue: 'user',
                input: false,
            },
            locale: {
                type: 'string',
                required: false,
                defaultValue: routing.defaultLocale,
            },
            profile: {
                type: 'string',
                defaultValue: 'individual',
            },
            basePrompt: {
                type: 'string',
                required: false,
            },
            phone: {
                type: 'string',
                required: false,
            },
            companyName: {
                type: 'string',
                required: false,
            },
            companyCode: {
                type: 'string',
                required: false,
            },
            companyPosition: {
                type: 'string',
                required: false,
            },
        },
    },
    session: {
        modelName: 'Session',
    },
    account: {
        modelName: 'Account',
        accountLinking: {
            enabled: true,
            allowDifferentEmails: true,
            trustedProviders: ['google', 'microsoft', 'email-password'],
        },
    },
    verification: {
        modelName: 'Verification',
    },
})

Client config

// client.ts
import { adminClient, inferAdditionalFields } from 'better-auth/client/plugins'
import { createAuthClient } from 'better-auth/react'
import type { auth as baseAuth } from './auth'

export const auth = createAuthClient({
    plugins: [inferAdditionalFields<typeof baseAuth>(), adminClient()],
})

Edit: fix versions

Originally created by @bmichotte on GitHub (Feb 17, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1473 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Using the following package.json <details> <summary>package.json</summary> ```json { "name": "my-project", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev --turbopack", "build": "next build" }, "prisma": { "seed": "bun run prisma/seed.ts" }, "dependencies": { "@ai-sdk/mistral": "^1.1.11", "@ai-sdk/openai": "^1.1.12", "@ai-sdk/react": "^1.1.16", "@fortawesome/fontawesome-svg-core": "^6.7.2", "@fortawesome/free-brands-svg-icons": "^6.7.2", "@fortawesome/pro-regular-svg-icons": "^6.7.2", "@fortawesome/pro-solid-svg-icons": "^6.7.2", "@fortawesome/pro-thin-svg-icons": "^6.7.2", "@fortawesome/react-fontawesome": "^0.2.2", "@gsap/react": "^2.1.2", "@hookform/resolvers": "^4.1.0", "@langchain/core": "^0.3.40", "@langchain/langgraph": "^0.2.46", "@langchain/openai": "^0.4.4", "@mdxeditor/editor": "^3.23.0", "@next/third-parties": "^15.1.7", "@paralleldrive/cuid2": "^2.2.2", "@prisma/client": "^6.3.1", "@radix-ui/react-accordion": "^1.2.3", "@radix-ui/react-alert-dialog": "^1.1.6", "@radix-ui/react-avatar": "^1.1.3", "@radix-ui/react-checkbox": "^1.1.4", "@radix-ui/react-context-menu": "^2.2.6", "@radix-ui/react-dialog": "^1.1.6", "@radix-ui/react-dropdown-menu": "^2.1.6", "@radix-ui/react-label": "^2.1.2", "@radix-ui/react-popover": "^1.1.6", "@radix-ui/react-radio-group": "^1.2.3", "@radix-ui/react-scroll-area": "^1.2.3", "@radix-ui/react-select": "^2.1.6", "@radix-ui/react-separator": "^1.1.2", "@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-switch": "^1.1.3", "@radix-ui/react-tabs": "^1.1.3", "@radix-ui/react-toggle": "^1.1.2", "@radix-ui/react-toggle-group": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.8", "@radix-ui/react-visually-hidden": "^1.1.2", "@sentry/nextjs": "^9.1.0", "@tanstack/react-table": "^8.21.2", "@uiw/react-json-view": "^2.0.0-alpha.30", "@vis.gl/react-google-maps": "^1.5.1", "ai": "^4.1.41", "air-datepicker": "^3.5.3", "better-auth": "1.1.17", "boring-avatars": "^1.11.2", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "cmdk": "1.0.4", "date-fns": "^4.1.0", "discord.js": "^14.18.0", "embla-carousel-react": "^8.5.2", "flat": "^6.0.1", "framer-motion": "^12.4.3", "i18n-iso-countries": "^7.13.0", "jodit-react": "^5.2.14", "jwt-decode": "^4.0.0", "lucide-react": "^0.475.0", "my-ua-parser": "^2.0.4", "next": "^15.1.7", "next-intl": "^3.26.3", "next-themes": "^0.4.4", "nodemailer": "^6.10.0", "pgvector": "^0.2.0", "qs": "^6.14.0", "react": "^19.0.0", "react-dom": "^19.0.0", "react-dropzone": "^14.3.5", "react-hook-form": "^7.54.2", "react-image-crop": "^11.0.7", "react-markdown": "^9.0.3", "rimraf": "^6.0.1", "server-only": "^0.0.1", "sharp": "^0.33.5", "slug": "^10.0.0", "sonner": "^1.7.4", "superjson": "^2.2.2", "tailwind-merge": "^3.0.1", "tailwindcss-animate": "^1.0.7", "tiktoken": "^1.0.20", "use-deep-compare-effect": "^1.8.1", "use-stick-to-bottom": "^1.0.46", "usehooks-ts": "^3.1.1", "vanilla-cookieconsent": "^3.1.0", "zod": "^3.24.2" }, "devDependencies": { "@biomejs/biome": "^1.9.4", "@tailwindcss/postcss": "^4.0.6", "@tailwindcss/typography": "^0.5.16", "@types/bun": "^1.2.2", "@types/google.maps": "^3.58.1", "@types/node": "^22.13.4", "@types/nodemailer": "^6.4.17", "@types/prompts": "^2.4.9", "@types/qs": "^6.9.18", "@types/react": "^19.0.10", "@types/react-dom": "^19.0.4", "@types/slug": "^5.0.9", "deepl-node": "^1.16.0", "dotenv": "^16.4.7", "dotenv-cli": "^8.0.0", "husky": "^9.1.7", "ora": "^8.2.0", "postcss": "^8.5.2", "prisma": "^6.3.1", "prompts": "^2.4.2", "tailwindcss": "^4.0.6", "typescript": "^5.7.3" } } ``` </details> I also [added my bun.lock](https://github.com/bmichotte/better-auth-issue-1473/blob/main/bun.lock) to be able to "bun install" the exact versions My project build without any issue. If I update better-auth to 1.1.18, I have the following crash ![Image](https://github.com/user-attachments/assets/6850e4f1-b2f8-4833-a4ca-977fdfb99e0d) ![Image](https://github.com/user-attachments/assets/5dc274f5-d0e2-45bd-91a3-2c321a835588) I tried to update to 1.1.18-beta.1 to find the "range" of commits, but it crashed also. Also tried 1.1.19-beta.2 without any luck either I can build 1.2.0-beta.9 (but I haven't tested it to see if my application still works) ### Current vs. Expected behavior 1.1.17 build, 1.1.18+ crashes ### What version of Better Auth are you using? 1.1.18 ### Provide environment information ```bash tested on - macOS 15.3 node 22.14.0 - Ubuntu 22.10 node 20.16.0 using - bun 1.2.0 - also tested with 9.12.2 ``` ### Which area(s) are affected? (Select all that apply) Package, Other ### Auth config ```ts // auth.ts import { betterAuth } from 'better-auth' import { prismaAdapter } from 'better-auth/adapters/prisma' import { prisma } from '@/lib/prisma' import { nextCookies } from 'better-auth/next-js' import { admin } from 'better-auth/plugins' import { routing, type Locale } from '@/i18n/routing' import { env } from '@/lib/env' import { send } from '@/lib/emails' export const auth = betterAuth({ database: prismaAdapter(prisma, { provider: 'postgresql', }), trustedOrigins: [env.BETTER_AUTH_URL], emailAndPassword: { enabled: true, sendResetPassword: async ({ user, url, token }, request) => { await send( 'forgot_password', { url, }, (user as unknown as { locale: Locale }).locale, { address: user.email, displayName: user.name } ) }, }, socialProviders: { google: { clientId: env.GOOGLE_CLIENT_ID, clientSecret: env.GOOGLE_CLIENT_SECRET, }, microsoft: { clientId: env.MICROSOFT_CLIENT_ID, clientSecret: env.MICROSOFT_CLIENT_SECRET, tenantId: env.MICROSOFT_CLIENT_TENANT_ID, }, }, plugins: [nextCookies(), admin()], user: { modelName: 'User', additionalFields: { role: { type: 'string', required: false, defaultValue: 'user', input: false, }, locale: { type: 'string', required: false, defaultValue: routing.defaultLocale, }, profile: { type: 'string', defaultValue: 'individual', }, basePrompt: { type: 'string', required: false, }, phone: { type: 'string', required: false, }, companyName: { type: 'string', required: false, }, companyCode: { type: 'string', required: false, }, companyPosition: { type: 'string', required: false, }, }, }, session: { modelName: 'Session', }, account: { modelName: 'Account', accountLinking: { enabled: true, allowDifferentEmails: true, trustedProviders: ['google', 'microsoft', 'email-password'], }, }, verification: { modelName: 'Verification', }, }) ``` ### Client config ```ts // client.ts import { adminClient, inferAdditionalFields } from 'better-auth/client/plugins' import { createAuthClient } from 'better-auth/react' import type { auth as baseAuth } from './auth' export const auth = createAuthClient({ plugins: [inferAdditionalFields<typeof baseAuth>(), adminClient()], }) ``` Edit: fix versions
GiteaMirror added the lockedbug labels 2026-04-17 16:32:06 -05:00
Author
Owner

@Bekacru commented on GitHub (Feb 17, 2025):

upgrade to 1.1.18

<!-- gh-comment-id:2663713120 --> @Bekacru commented on GitHub (Feb 17, 2025): upgrade to 1.1.18
Author
Owner

@bmichotte commented on GitHub (Feb 17, 2025):

Sorry, its a typo on the issue. I was talking about 1.1.17 and 1.1.18

Edit: typo fixed

<!-- gh-comment-id:2663979837 --> @bmichotte commented on GitHub (Feb 17, 2025): Sorry, its a typo on the issue. I was talking about 1.1.17 and 1.1.18 Edit: typo fixed
Author
Owner

@sindhukhrisna commented on GitHub (Feb 18, 2025):

I'm using NextJS + Better-Auth,
haven't tested building yet, but as soon as I update better-auth to 1.1.18, my typescript IntelliSense becomes unbearably slow and increases ram usage each time I press ctrl + space. happens only in pages that import checks for session

I rolled back to 1.1.17 for now

<!-- gh-comment-id:2665638364 --> @sindhukhrisna commented on GitHub (Feb 18, 2025): I'm using NextJS + Better-Auth, haven't tested building yet, but as soon as I update better-auth to 1.1.18, my typescript IntelliSense becomes unbearably slow and increases ram usage each time I press ctrl + space. happens only in pages that import checks for session I rolled back to 1.1.17 for now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#26097