Expo React native node:buffer #729

Closed
opened 2026-03-13 08:01:51 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @yassinrais on GitHub (Feb 23, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

install the latest version of better-auth in an expo react native project

Works fine with better-auth@1.1.4

Current vs. Expected behavior

iOS Bundling failed 983ms node_modules/expo-router/entry.js (2434 modules)
The package at "node_modules/jose/dist/node/esm/runtime/base64url.js" attempted to import the Node standard library module "node:buffer".
It failed because the native React runtime does not include the Node standard library.

What version of Better Auth are you using?

^1.1.19

Provide environment information

% npm list jose
project@ /Users/abc/acme/project
└─┬ app-mobile@1.0.0 -> ./apps/mobile
  └─┬ better-auth@1.1.19
    └── jose@5.10.0

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

Client

Auth config (if applicable)

import { expoClient } from '@better-auth/expo/client';
import {
	emailOTPClient,
	inferAdditionalFields,
	organizationClient,
} from 'better-auth/client/plugins';
import { createAuthClient } from 'better-auth/react';
import { auth } from '../../../../api/src/plugins/auth/better-auth';

import * as SecureStore from 'expo-secure-store';
import { Platform } from 'react-native';

const authClient = createAuthClient({
	baseURL: 'http://localhost:1234/',
	plugins: [
		expoClient({
			scheme: 'test',
			storagePrefix: 'test',
			storage:
				Platform.OS === 'web'
				   ? {
					getItem: window.localStorage.getItem,
					setItem: window.localStorage.setItem,
			              }
				   : SecureStore,
		}),
		organizationClient(),
		inferAdditionalFields<typeof auth>(),
		emailOTPClient(),
	],
});

export default authClient;

Additional context

No response

Originally created by @yassinrais on GitHub (Feb 23, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce install the latest version of better-auth in an expo react native project Works fine with `better-auth@1.1.4` ### Current vs. Expected behavior ``` iOS Bundling failed 983ms node_modules/expo-router/entry.js (2434 modules) The package at "node_modules/jose/dist/node/esm/runtime/base64url.js" attempted to import the Node standard library module "node:buffer". It failed because the native React runtime does not include the Node standard library. ``` ### What version of Better Auth are you using? ^1.1.19 ### Provide environment information ```bash % npm list jose project@ /Users/abc/acme/project └─┬ app-mobile@1.0.0 -> ./apps/mobile └─┬ better-auth@1.1.19 └── jose@5.10.0 ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { expoClient } from '@better-auth/expo/client'; import { emailOTPClient, inferAdditionalFields, organizationClient, } from 'better-auth/client/plugins'; import { createAuthClient } from 'better-auth/react'; import { auth } from '../../../../api/src/plugins/auth/better-auth'; import * as SecureStore from 'expo-secure-store'; import { Platform } from 'react-native'; const authClient = createAuthClient({ baseURL: 'http://localhost:1234/', plugins: [ expoClient({ scheme: 'test', storagePrefix: 'test', storage: Platform.OS === 'web' ? { getItem: window.localStorage.getItem, setItem: window.localStorage.setItem, } : SecureStore, }), organizationClient(), inferAdditionalFields<typeof auth>(), emailOTPClient(), ], }); export default authClient; ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 08:01:51 -05:00
Author
Owner

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

should be fixed on 1.1.20-beta.3

@Bekacru commented on GitHub (Feb 23, 2025): should be fixed on `1.1.20-beta.3`
Author
Owner

@yassinrais commented on GitHub (Mar 6, 2025):

Thanks! ❤

@yassinrais commented on GitHub (Mar 6, 2025): Thanks! ❤
Author
Owner

@vidhunv1 commented on GitHub (Mar 6, 2025):

I'm on ^1.1.21 and I get this same error.

This happens only when I use the anonymous plugin.

@vidhunv1 commented on GitHub (Mar 6, 2025): I'm on `^1.1.21` and I get this same error. This happens only when I use the `anonymous` plugin.
Author
Owner

@brianwk commented on GitHub (Sep 4, 2025):

I'm now getting this error on 1.3.8 of better-auth with Expo / React Native. (Expo SDK 53)

When I downgrade to better-auth and better-auth/expo 1.3.7 the problem no longer persists.

Update: Installing react-native-webcrypto and importing it in the boostrap index.js fixed the issue

@brianwk commented on GitHub (Sep 4, 2025): I'm now getting this error on 1.3.8 of better-auth with Expo / React Native. (Expo SDK 53) When I downgrade to better-auth and better-auth/expo 1.3.7 the problem no longer persists. **Update:** Installing react-native-webcrypto and importing it in the boostrap index.js fixed the issue
Author
Owner

@jancbeck commented on GitHub (Sep 9, 2025):

I'm having this issue too. I don't see anything obvious that would cause this though?
https://github.com/better-auth/better-auth/pull/4410/files#diff-a95fa03eaa3ede5409efe90244f6f137c4f09e3354e652b4a4d20500f23c4f40
I'm on SDK 54 preview

@jancbeck commented on GitHub (Sep 9, 2025): I'm having this issue too. I don't see anything obvious that would cause this though? https://github.com/better-auth/better-auth/pull/4410/files#diff-a95fa03eaa3ede5409efe90244f6f137c4f09e3354e652b4a4d20500f23c4f40 I'm on SDK 54 preview
Author
Owner

@IronHeartDan commented on GitHub (Oct 16, 2025):

+1

@IronHeartDan commented on GitHub (Oct 16, 2025): +1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#729