React Native - Need to execute cloud function two time for it to work

57 views Asked by At

I have a cloud function:

const deleteUser = async () => {
    functions().httpsCallable('deleteUser')().then(response => {
        console.log("Delete User Response -> ", response);
    })
    signOut();
}

Function works fine for iOS (built using swift) But for my react native app im using the code above.

But I need to run it 2 times for it to work.

E.g.

  • Press delete user button
  • User gets signed out (this is right but it missed running the delete function)
  • I log back in Press delete user button again
  • Signs me out
  • delete function runs (deletes the user) and shows me the following log

Delete User Response -> {"data": true}

Not sure why its not working the first time round?

The first time I try to delete the user (when it fails) I see the following in the terminal (these are not logs im printing)

Error: INTERNAL Error: INTERNAL

0

There are 0 answers