[Expo] App crashes (SIGABRT) on first launch when calling signIn.social() - production builds only #2925

Closed
opened 2026-03-13 10:28:03 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @quuentinho on GitHub (Feb 26, 2026).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Build a production iOS app with @better-auth/expo using expo-secure-store as storage
  2. Install via TestFlight (fresh install, not an update)
  3. Tap Google or Apple sign-in
  4. App crashes immediately

Current vs. Expected behavior

Current behavior

On a fresh production install (TestFlight), tapping Google or Apple sign-in causes an immediate native crash (SIGABRT in ObjCTurboModule::performVoidMethodInvocation). The app terminates without any JS error being catchable.

After force-closing and reopening the app, the exact same sign-in flow works perfectly.

This only happens on production builds (developmentClient: false). Development builds never crash.

Expected behavior

Social sign-in should work on the very first launch of a fresh production install, without requiring the user to force-close and reopen the app.

What version of Better Auth are you using?

1.4.17

System info

{
  "system": {
    "platform": "darwin",
    "arch": "arm64",
    "version": "Darwin Kernel Version 25.0.0: Wed Sep 17 21:42:08 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8132",
    "release": "25.0.0",
    "cpuCount": 10,
    "cpuModel": "Apple M4",
    "totalMemory": "16.00 GB",
    "freeMemory": "0.27 GB"
  },
  "node": {
    "version": "v24.11.0",
    "env": "development"
  },
  "packageManager": {
    "name": "npm",
    "version": "11.6.1"
  },
  "frameworks": [
    {
      "name": "next",
      "version": "16.1.1"
    },
    {
      "name": "react",
      "version": "19.2.3"
    }
  ],
  "databases": [
    {
      "name": "pg",
      "version": "^8.16.3"
    },
    {
      "name": "postgres",
      "version": "^3.4.7"
    },
    {
      "name": "drizzle",
      "version": "^0.45.1"
    }
  ],
  "betterAuth": {
    "version": "^1.4.17",
    "config": null
  }
}

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

Client

Auth config (if applicable)

export const auth = betterAuth({
    database: drizzleAdapter(db, {
        provider: "pg",
        schema: { ... },
    }),
    user: {
        additionalFields: {
            firstname: { type: "string", returned: true, input: true },
            lastname: { type: "string", returned: true, input: true },
            language: { type: "string", returned: true, input: true, defaultValue: "fr" },
            // + other custom fields (birthYear, phoneNumber, gender, etc.)
        },
    },
    trustedOrigins: ["myapp://", "https://appleid.apple.com"],
    session: {
        cookieCache: {
            enabled: process.env.NODE_ENV === "production",
            maxAge: 5 * 60,
        },
        expiresIn: 7 * 24 * 60 * 60,
        updateAge: 1 * 24 * 60 * 60,
    },
    emailAndPassword: { enabled: true },
    socialProviders: {
        google: {
            clientId: process.env.GOOGLE_CLIENT_ID,
            clientSecret: process.env.GOOGLE_CLIENT_SECRET,
            prompt: "select_account",
            mapProfileToUser: (profile) => ({
                name: profile.name,
                firstname: profile.given_name || "",
                lastname: profile.family_name || "",
            }),
        },
        apple: {
            clientId: process.env.APPLE_CLIENT_ID,
            clientSecret: process.env.APPLE_CLIENT_SECRET,
            appBundleIdentifier: process.env.APPLE_APP_BUNDLE_IDENTIFIER,
            mapProfileToUser: (profile) => ({
                name: [profile.name?.firstName, profile.name?.lastName].filter(Boolean).join(" ") || "",
                firstname: profile.name?.firstName || "",
                lastname: profile.name?.lastName || "",
            }),
        },
    },
    account: {
        accountLinking: {
            enabled: true,
            allowDifferentEmails: true,
            updateUserInfoOnLink: true,
        },
    },
    plugins: [
        adminPlugin(),
        emailOTP({ otpLength: 6, expiresIn: 600, /* ... */ }),
        customSession(async ({ user, session }) => {
            // Adds custom fields to session (role, permissions, etc.)
            return { user: { ...user, /* custom fields */ }, session }
        }),
        apiKey(),
        organization({ /* roles, schema extensions, teams */ }),
        anonymous(),
        expo(),
        bearer(),
        nextCookies(), // last
    ],
    advanced: {
        database: { generateId: false },
        disableOriginCheck: false,
    },
})

Additional context

### Crash log (from TestFlight)

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Thread 0 Crashed:
0 libsystem_kernel.dylib __pthread_kill + 8
1 libsystem_pthread.dylib pthread_kill + 268
2 libsystem_c.dylib abort + 128
3 libc++abi.dylib abort_message + 132
4 libc++abi.dylib demangling_terminate_handler() + 332
5 libobjc.A.dylib _objc_terminate() + 160
6 libc++abi.dylib std::__terminate() + 16
7 libc++abi.dylib __cxa_rethrow + 204
8 libobjc.A.dylib objc_exception_rethrow + 44
9 hermes facebook::hermes::HermesRuntimeImpl::call() + 560
10 React ObjCTurboModule::performVoidMethodInvocation() + 232
(RCTTurboModule.mm:441)

Originally created by @quuentinho on GitHub (Feb 26, 2026). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Build a production iOS app with @better-auth/expo using expo-secure-store as storage 2. Install via TestFlight (fresh install, not an update) 3. Tap Google or Apple sign-in 4. App crashes immediately ### Current vs. Expected behavior ### **Current behavior** On a fresh production install (TestFlight), tapping Google or Apple sign-in causes an immediate native crash (SIGABRT in ObjCTurboModule::performVoidMethodInvocation). The app terminates without any JS error being catchable. After force-closing and reopening the app, the exact same sign-in flow works perfectly. This only happens on production builds (developmentClient: false). Development builds never crash. ### **Expected behavior** Social sign-in should work on the very first launch of a fresh production install, without requiring the user to force-close and reopen the app. ### What version of Better Auth are you using? 1.4.17 ### System info ```bash { "system": { "platform": "darwin", "arch": "arm64", "version": "Darwin Kernel Version 25.0.0: Wed Sep 17 21:42:08 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8132", "release": "25.0.0", "cpuCount": 10, "cpuModel": "Apple M4", "totalMemory": "16.00 GB", "freeMemory": "0.27 GB" }, "node": { "version": "v24.11.0", "env": "development" }, "packageManager": { "name": "npm", "version": "11.6.1" }, "frameworks": [ { "name": "next", "version": "16.1.1" }, { "name": "react", "version": "19.2.3" } ], "databases": [ { "name": "pg", "version": "^8.16.3" }, { "name": "postgres", "version": "^3.4.7" }, { "name": "drizzle", "version": "^0.45.1" } ], "betterAuth": { "version": "^1.4.17", "config": null } } ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript export const auth = betterAuth({ database: drizzleAdapter(db, { provider: "pg", schema: { ... }, }), user: { additionalFields: { firstname: { type: "string", returned: true, input: true }, lastname: { type: "string", returned: true, input: true }, language: { type: "string", returned: true, input: true, defaultValue: "fr" }, // + other custom fields (birthYear, phoneNumber, gender, etc.) }, }, trustedOrigins: ["myapp://", "https://appleid.apple.com"], session: { cookieCache: { enabled: process.env.NODE_ENV === "production", maxAge: 5 * 60, }, expiresIn: 7 * 24 * 60 * 60, updateAge: 1 * 24 * 60 * 60, }, emailAndPassword: { enabled: true }, socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET, prompt: "select_account", mapProfileToUser: (profile) => ({ name: profile.name, firstname: profile.given_name || "", lastname: profile.family_name || "", }), }, apple: { clientId: process.env.APPLE_CLIENT_ID, clientSecret: process.env.APPLE_CLIENT_SECRET, appBundleIdentifier: process.env.APPLE_APP_BUNDLE_IDENTIFIER, mapProfileToUser: (profile) => ({ name: [profile.name?.firstName, profile.name?.lastName].filter(Boolean).join(" ") || "", firstname: profile.name?.firstName || "", lastname: profile.name?.lastName || "", }), }, }, account: { accountLinking: { enabled: true, allowDifferentEmails: true, updateUserInfoOnLink: true, }, }, plugins: [ adminPlugin(), emailOTP({ otpLength: 6, expiresIn: 600, /* ... */ }), customSession(async ({ user, session }) => { // Adds custom fields to session (role, permissions, etc.) return { user: { ...user, /* custom fields */ }, session } }), apiKey(), organization({ /* roles, schema extensions, teams */ }), anonymous(), expo(), bearer(), nextCookies(), // last ], advanced: { database: { generateId: false }, disableOriginCheck: false, }, }) ``` ### Additional context **### Crash log (from TestFlight)** Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Thread 0 Crashed: 0 libsystem_kernel.dylib __pthread_kill + 8 1 libsystem_pthread.dylib pthread_kill + 268 2 libsystem_c.dylib abort + 128 3 libc++abi.dylib abort_message + 132 4 libc++abi.dylib demangling_terminate_handler() + 332 5 libobjc.A.dylib _objc_terminate() + 160 6 libc++abi.dylib std::__terminate() + 16 7 libc++abi.dylib __cxa_rethrow + 204 8 libobjc.A.dylib objc_exception_rethrow + 44 9 hermes facebook::hermes::HermesRuntimeImpl::call() + 560 10 React ObjCTurboModule::performVoidMethodInvocation() + 232 (RCTTurboModule.mm:441)
GiteaMirror added the expobug labels 2026-03-13 10:28:03 -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#2925