Skip to content

fix(android): resolve signUpWithPassword with a WritableMap - #25

Merged
benjamineruvieru merged 1 commit into
benjamineruvieru:mainfrom
qamarq:fix/sign-up-with-password-writable-map
Sep 17, 2026
Merged

benjamineruvieru merged 1 commit into
benjamineruvieru:mainfrom
qamarq:fix/sign-up-with-password-writable-map

Conversation

@qamarq

@qamarq qamarq commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #23.

Problem

On Android, signUpWithPassword saves the credential and then crashes the app when it resolves the promise:

java.lang.RuntimeException: Cannot convert argument of type class java.util.LinkedHashMap
  at com.facebook.react.bridge.Arguments.fromJavaArgs
  at com.facebook.react.bridge.PromiseImpl.resolve
  at com.credentialsmanager.CredentialsManagerModule$signUpWithPassword$1.invokeSuspend

The success result is built with Kotlin mapOf(...), which is a java.util.LinkedHashMap. Promise.resolve only accepts primitives and WritableMap/WritableArray, so it throws. The exception is raised inside the coroutine, so it takes down the process and can't be caught from JS. The other methods (signIn, createPasskey) already build their results with Arguments.createMap(), so only signUpWithPassword is affected.

Change

Build the result with Arguments.createMap() in both the new and old architecture modules. The shape resolved to JS is unchanged: { type: "password", username, success: true }.

We've been running this as a pnpm patch on 0.8.1 in production (Expo SDK 57, React Native 0.86, New Architecture). Saving a password after sign-up and after email login no longer crashes.

@qamarq

qamarq commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

@benjamineruvieru ^

@benjamineruvieru

Copy link
Copy Markdown
Owner

@benjamineruvieru ^

Thank you for your contribution

@benjamineruvieru
benjamineruvieru merged commit 3c6bf76 into benjamineruvieru:main Sep 17, 2026
4 of 5 checks passed
@qamarq
qamarq deleted the fix/sign-up-with-password-writable-map branch September 20, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] signUpWithPassword crashes on resolve: returns a LinkedHashMap instead of a WritableMap

2 participants