locked
Firebase exception RRS feed

  • Question

  • User382921 posted

    Hi all, I got a problem when I add more nodes to my list the app crashes and I get this exception:

    Unhandled Exception:

    Firebase.Database.FirebaseException: Exception occured while processing the request. Url: https://cabinetveterinar-335bc.firebaseio.com/data/aq3xtjZiCic6gHqMHdP0gmu0A8D3/MedsTest/Meds/.json Request Data: Response: {"Ana":{"BarCode":4001686117167,"Description":"Ana are mere","Name":"Ana","NumberInStock":12,"Species":"ana"},"Aqua":{"BarCode":5942326400049,"Description":"Apa minerala","Name":"Aqua","NumberInStock":4,"Species":"om"},"Haribo":{"BarCode":4001686117194,"Description":"Este o punga de haribo :)","Name":"Haribo","NumberInStock":3,"Species":"Om"}}

    The code is like this: public async Task Read() { AppData.medsList = new List();

                ChildQuery listsNode = AppDataDroid.dataNode.Child(AppData.localUser.Uid);
    
                var allListsData = await listsNode.OnceAsync<TempGroceryListClass>();
    
                foreach (FirebaseObject<TempGroceryListClass> any in allListsData)
                {
                    List<MedsClass> itemsOfList = new List<MedsClass>();
    
                    ChildQuery thisListNode = listsNode.Child(any.Object.Name);
    
                    var readItems = await thisListNode.Child("Meds").OnceAsync<MedsClass>();
    
                    foreach (FirebaseObject<MedsClass> anyItem in readItems)
                        itemsOfList.Add(anyItem.Object);
    
                    UsersMedsClass newReadList = new UsersMedsClass
                    {
                        Name = any.Object.Name,
                        Meds = itemsOfList,
                        Owner = any.Object.Owner
                    };
    
                    AppData.medsList.Add(newReadList);
                }
            }
    

    And I have four classes:

    public class TempGroceryListClass { public string Name { get; set; } public UserClass Owner { get; set; } }

    public class UsersMedsClass { public string Name { get; set; } public List Meds { get; set; } public UserClass Owner { get; set; } }

    public class MedsClass { public string Name { get; set; } public string Description { get; set; } public string Species { get; set; } public int BarCode { get; set; } public int NumberInStock { get; set; } }

    public class UserClass
    {
        public string Name { get; set; }
        public string Email { get; set; }
        public string Uid { get; set; }
    }
    

    Hope I added everything so you guys can help me...

    Tuesday, June 4, 2019 7:57 PM

Answers

  • User382871 posted

    Use the code in FirebaseOptions to trigger the auth.FirebaseAuthRefreshed event. new FirebaseOptions { AuthTokenAsyncFactory = async () => (await auth.GetFreshAuthAsync()).FirebaseToken }); Code: https://github.com/step-up-labs/firebase-database-dotnet/blob/master/src/Firebase/FirebaseException.cs

    Similar issue: https://github.com/step-up-labs/firebase-database-dotnet/issues/87

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, June 5, 2019 6:12 AM

All replies

  • User382871 posted

    Use the code in FirebaseOptions to trigger the auth.FirebaseAuthRefreshed event. new FirebaseOptions { AuthTokenAsyncFactory = async () => (await auth.GetFreshAuthAsync()).FirebaseToken }); Code: https://github.com/step-up-labs/firebase-database-dotnet/blob/master/src/Firebase/FirebaseException.cs

    Similar issue: https://github.com/step-up-labs/firebase-database-dotnet/issues/87

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Wednesday, June 5, 2019 6:12 AM
  • User382921 posted

    @yelinzh said: Use the code in FirebaseOptions to trigger the auth.FirebaseAuthRefreshed event. new FirebaseOptions { AuthTokenAsyncFactory = async () => (await auth.GetFreshAuthAsync()).FirebaseToken }); Code: https://github.com/step-up-labs/firebase-database-dotnet/blob/master/src/Firebase/FirebaseException.cs

    Similar issue: https://github.com/step-up-labs/firebase-database-dotnet/issues/87

    I don`t get it where should I put it...

    Wednesday, June 5, 2019 1:59 PM
  • User382921 posted

    I fixed it thank you :smile:

    Wednesday, June 5, 2019 3:28 PM