Skip to content

signInWithEmailAndPassword() coroutine hangs on error #7

Closed
@fmasa

Description

@fmasa

When the email is invalid, the password is invalid, or the email is not found, the API returns 400 with an error payload. From that the error.message JSON field should be passed as errorCode to the FirebaseException constructor.

Right now HTTP message (which is an empty string) is passed instead and since the FirebaseException requires the error code to be not empty, the constructor throws an exception. This exception is not passed to Task and the coroutine is never resumed.

Exception in thread "OkHttp Dispatcher" java.lang.IllegalArgumentException: Given String is empty or null
	at com.google.android.gms.common.internal.Preconditions.checkNotEmpty(com.google.android.gms:play-services-basement@@18.1.0:2)
	at com.google.firebase.auth.FirebaseAuthException.<init>(com.google.firebase:firebase-auth-interop@@20.0.0:2)
	at com.google.firebase.auth.FirebaseAuthInvalidUserException.<init>(FirebaseAuthInvalidUserException.kt:3)
	at com.google.firebase.auth.FirebaseAuth$signInWithEmailAndPassword$1.onResponse(FirebaseAuth.kt:248)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions