Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS signInWithEmailAndPassword fails to parse Firebase response when using blocking functions with Authentication #655

Open
csandels opened this issue Oct 22, 2024 · 0 comments

Comments

@csandels
Copy link

On iOS, when a Firebase blocking function attached to beforeUserSignedIn is used with Authentication and that function throws an error with a type other than "internal", the gitlive code is unable to parse the response. With other platforms, the message given to the HttpsError constructor in the function is passed all the way to the client code as the message on the exception, as expected. But with iOS, a client side error is thrown saying "JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0.".

https://firebase.google.com/docs/auth/extend-with-blocking-functions?gen=2nd

When function does this:
throw new HttpsError('internal', 'Problem with authentication')

Error looks like this:
Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={NSUnderlyingError=0x600000d61890 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={ code = 503; errors = ( { domain = global; message = "Error code: 47"; reason = backendError; } ); message = "Error code: 47"; }, NSUnderlyingError=0x600000b1ddc0 {Error Domain=com.google.HTTPStatus Code=503 "(null)" UserInfo={data={length = 207, bytes = 0x7b0a2020 22198272 6f72223a 201a3a20 ... 5d0a2020 7d0a7d0a }, data_content_type=application/json; charset=UTF-8}}}}, FIRAuthErrorUserInfoNameKey=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.}

When function does this:
throw new HttpsError('unauthenticated', 'Some other reason')

Error looks like this:
Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information., NSUnderlyingError=0x600000fee456 {Error Domain=FIRAuthInternalErrorDomain Code=2 "(null)" UserInfo={NSUnderlyingError=0x600000fee123 {Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0., NSJSONSerializationErrorIndex=0}}}}, FIRAuthErrorUserInfoNameKey=ERROR_INTERNAL_ERROR}

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

No branches or pull requests

1 participant