Describe the bug
On Android, signUpWithPassword crashes the app when the promise resolves (right after the credential is saved). The native module builds its success response with mapOf(...), which is a java.util.LinkedHashMap. The promise-resolve converter Arguments.fromJavaArgs only accepts WritableNativeMap/WritableNativeArray and primitives, so promise.resolve(...) throws. The credential save itself succeeds — only returning the result crashes. The sibling methods (signIn, createPasskey) already build their response with Arguments.createMap(), so only signUpWithPassword is affected.
Environment
- React Native version: 0.85.3 (New Architecture enabled)
- Library version: 0.8.1 (same
mapOf is on main)
- Platform: Android
- Device information:
- iOS: N/A
- Android: any device, the failing step is a JS-bridge type conversion, not device-, OS-, or Kotlin-version-specific
Steps to Reproduce
- On Android, call
signUpWithPassword({ username, password }).
- Accept the system password-manager save dialog.
- The app crashes as the promise resolves.
Expected behavior
The promise resolves with the result and the app continues.
Actual behavior
The app crashes with:
java.lang.RuntimeException: Cannot convert argument of type class java.util.LinkedHashMap
at com.facebook.react.bridge.Arguments.fromJavaArgs(Arguments.kt:159)
at com.facebook.react.bridge.PromiseImpl.resolve(PromiseImpl.kt:29)
at com.credentialsmanager.CredentialsManagerModule$signUpWithPassword$1.invokeSuspend(CredentialsManagerModule.kt:76)
Screenshots
N/A
Code snippet
await signUpWithPassword({ username: "user@example.com", password: "secret" })
// save succeeds, then the promise resolve crashes the app
The cause is in signUpWithPassword (both newarch and oldarch modules):
val result = mapOf("type" to "password", "username" to username, "success" to true)
promise.resolve(result) // LinkedHashMap is not a WritableNativeMap
Suggested fix — build a WritableMap, as signIn/createPasskey already do:
val result = Arguments.createMap().apply {
putString("type", "password")
putString("username", username)
putBoolean("success", true)
}
promise.resolve(result)
Additional context
- Physical device and emulator: the crash is in the JS bridge type conversion, so it is independent of device/emulator.
- Latest version: yes, reproduced on 0.8.1 (latest published); the same
mapOf is on main.
Arguments.fromJavaArgs matches arguments against an exact-class whitelist (null, Boolean, Int, Double, Float, String, WritableNativeMap, WritableNativeArray), throwing on anything else, so a raw LinkedHashMap always fails.
Describe the bug
On Android,
signUpWithPasswordcrashes the app when the promise resolves (right after the credential is saved). The native module builds its success response withmapOf(...), which is ajava.util.LinkedHashMap. The promise-resolve converterArguments.fromJavaArgsonly acceptsWritableNativeMap/WritableNativeArrayand primitives, sopromise.resolve(...)throws. The credential save itself succeeds — only returning the result crashes. The sibling methods (signIn,createPasskey) already build their response withArguments.createMap(), so onlysignUpWithPasswordis affected.Environment
mapOfis onmain)Steps to Reproduce
signUpWithPassword({ username, password }).Expected behavior
The promise resolves with the result and the app continues.
Actual behavior
The app crashes with:
Screenshots
N/A
Code snippet
The cause is in
signUpWithPassword(bothnewarchandoldarchmodules):Suggested fix — build a
WritableMap, assignIn/createPasskeyalready do:Additional context
mapOfis onmain.Arguments.fromJavaArgsmatches arguments against an exact-class whitelist (null,Boolean,Int,Double,Float,String,WritableNativeMap,WritableNativeArray), throwing on anything else, so a rawLinkedHashMapalways fails.