-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Summary
I have been running mallory locally on web, but when i tried loggin in using the same OAuth account on expo, i encountered the following
- On a fresh Android build, the onboarding flow crashes when it tries to create a conversation because
uuidv4()callscrypto.getRandomValues, which doesn’t exist on React Native by default. - After that, the Grid auto-init repeatedly throws
TypeError: Network request failedbecause the client hitshttp://localhost:3001, which is unreachable from the emulator.
Steps to Reproduce
- Clone the repo,
bun install. - Start the backend (
bun run server) or leave it stopped to see both failures. - In another terminal:
cd apps/client && bun run android. - In the Android emulator (Pixel 9 Pro XL), sign in with Google. Android Studio must be installed
- Wait for the onboarding conversation and Grid auto-init to fire.
Actual Result
-
Client logs show:
ERROR ❌ CRITICAL ERROR creating new conversation: [Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported] -
Even after polyfilling manually, Grid sign-in logs:
ERROR ❌ [Grid Client] Sign-in start error: [TypeError: Network request failed]because the request targets
http://localhost:3001as set in the client.envfile
Expected Result
- The onboarding conversation is created (no UUID crash).
- Grid auto-init reaches the backend, triggering the OTP flow instead of a network error.
Environment
- macOS 15.0 (Darwin 25.0.0)
- Node.js v23.10.0
- Bun v1.3.2
- Expo CLI (via
bun run android) - Emulator: Android Pixel 9 Pro XL, Android 14 (API 34)
- Backend: Mallory server from this repo (
bun run server)
Relevant Logs / Notes
ERROR ❌ CRITICAL ERROR creating new conversation: [Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported]
...
ERROR ❌ [Grid Client] Sign-in start error: [TypeError: Network request failed]
Running curl http://localhost:3001/health on the Mac succeeds, but inside the emulator you must use http://10.0.2.2:3001/health. Here 10.0.2.2 is Android’s alias for your computer
Suggested fixes:
I have made slight changes to my apps/client/polyfills.js and apps/client/lib/config.ts to solve the issue highlighted here. Fixes include:
apps/client/polyfills.js
Added react-native-get-random-values (with an expo-random fallback) whenever Platform.OS !== 'web'. This polyfills crypto.getRandomValues so uuidv4() works on Android.apps/client/lib/config.ts
Added a platform-aware helper: if the backend URL contains localhost/127.0.0.1 and we’re on Android, rewrite it to 10.0.2.2 so the emulator hits the host machine.
Next steps:
- I will bite off a PR if other developers are also facing the same issue.
Metadata
Metadata
Assignees
Labels
No labels