locked
FireBase error Exception occured while processing the request RRS feed

  • Question

  • User389755 posted

    Hello everyone, this is my first post.

    I have some trouble that I use FirebaseDataBase.Net api to implement auth and query data, but it always crash. I have spent quite time on google, but no solution I found.

    this is my code:

    var client = new FirebaseClient("https://testforpatientdb.firebaseio.com", 
                            new FirebaseOptions { AuthTokenAsyncFactory = async() => 
                            await auth.LoginWithEmailPassword(AccountEntry.Text, PasswordEntry.Text) });
    //auth.login is refer from "https://medium.com/firebase-developers/firebase-auth-on-xamarin-forms-171432aa3d76"
    var firebase = client.Child("Patients");
    
    var child = await firebase.OrderByKey().OnceAsync<Patient>();
    //I use step by step execute, and I found this line is problem.
    

    it will show exception message like: Firebase.Database.FirebaseException: 'Exception occured while processing the request. Request Data: Response: [{"FamilyPhoneNumber":"4321-65","Name":"Xi","PatientStatus":"Danger","Pricipal":"SB","PricipalPhoneNumber":"1234-1"}]'

    this is my firebase data:

    {
      "Patients" : [ {
        "FamilyPhoneNumber" : "4321-65",
        "Name" : "Xi",
        "PatientStatus" : "Danger",
        "Pricipal" : "SB",
        "PricipalPhoneNumber" : "1234-1"
      } ]
    }
    

    I think I have actually gotten response data from firebase accroding to the exception. but I don't know how to fix it not to crash. please give me some solution! thanks.

    Tuesday, October 22, 2019 3:44 PM

All replies

  • User389755 posted

    Is there anyone can help me? Please Orz

    Wednesday, October 23, 2019 4:08 AM
  • User379860 posted

    @nani0979, First of all, please check the rules about the rule of FireBase. set read/write rule to null

     {  
      /* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */  
     "rules": {  
         ".read": "auth==null",  
         ".write":"auth==null"  
       }  
     } 
    

    Then, normally, when you add the data to firebase database, your data like following this screenshot.

    You can follow this thread step by step to achieve the CRUD. https://www.c-sharpcorner.com/article/xamarin-forms-working-with-firebase-realtime-database-crud-operations/

    Wednesday, October 23, 2019 9:57 AM