[Solved] Why can’t I save and retrieve data from Firebase?

Hello! I apologize if I’m posting a bit too often, but I encountered a few more (and hopefully, my last!) issues. (I’m using the DnD UI btw!)
In the first picture, what I’m trying to do is save in a realtime DB the user’s ID, along with their email, the message written in a text input and the pictures/videos taken/chosen from their gallery. I attributed to the variable ‘list’ an empty list, as it’s shown below. The first issue is that nothing changes in the DB (I may have not accessed it correctly, I’ve watched some tutorials but I’m pretty new to all of this and still learning!)
Nothing has been added to the DB no matter how many times I try, and for some reason, every time I try to snap a photo or choose a picture or video from my files (as it’s shown from the second picture until the last), the app crashes.
I have 3 images + 1 video added to the design and they act as a list.
I’m sorry if there’s anything that’s been explained vaguely, please ask me if there’s any more info needed. Thank you so much once again!



This is always the first thing I troubleshoot. If you cannot add a value to Firebase or get a value from Firebase, then it’s not going to make sense to try to do something really complicated like storing photos. We’ll get there but for now, let’s keep things really simple so there aren’t too many variables we have to contend with.

Can you save a simple value like a text string (“test”) to Firebase?

If not, have you entered your authentication information for your Firebase account in Thunkable? Have you set the Realtime Database rules to allow access in your Firebase Console?

If you’re still having trouble, post a screenshot of the blocks you’re using for this simple test.


Something so simple… I can’t believe I forgot about the rules!! I changed the .write from ‘false’ to ‘true’ and it did the trick! Thank you a lot!! :blush:


Hello! Using the advice you gave me, I managed to make this bit of code work as it’s supposed to do, yet once again, it keeps crashing on me :frowning: Firebase is saving all of my data, yet when I choose to take a picture/a video, it crashes before I can even submit the data (when I only submit a message, it is saved in the DB) and this worries me. If possible, can you give me some pointers on what should be changed in the code? Thanks!

I suspect that part of the problem is that you’re saving the Image component’s picture value to a list that gets added to Firebase rather than the url that is generated by the green photo block. So try this: when the photo is taken, set a variable (not a list… let’s keep this simple) to the green photo block. Then see if you can save that variable’s value to Firebase in the Media property (instead of app variable list). Does that work?

I’m also curious… how long are you waiting between the time you take a photo and the time you submit the data to Firebase? Because generating the green photo block’s value can take a long time. In my experience, as much as 10 seconds or even more. This is the time it takes for Thunkable to upload the photo to Cloudinary and then for Cloudinary to return a url for that photo. It’s possible you’re not giving enough time before trying to save that value to Firebase.

If those suggestions don’t fix the problem, I recommend doing some careful debugging using a strategy I use where you insert a pair of blocks (or a function) that change a label value (e.g. “1”) and then wait a small amount of time and then repeat (e.g. “2” and so on). If you sprinkle those throughout your code, you can see the exact moment when it crashes. I provide examples of that here: Debugging in Thunkable X (Video).


if only I could add 2 solutions to the same topic… you’re the bestest! Thank you a lot, I had an inkling it would be the list causing all these issues, and you were right! I changed everything to a separate variable for each picture and video (could be done more efficiently than this but I’m lazy) then simply attached them to the ‘Media’ field using the ‘join’ function, yay!

And it does take a long time for the whole process to finish, however I’m too afraid to modify anything anymore in case it breaks overnight like it did to me. What matters is it works again! Cheers!

1 Like

You’re welcome!

If you’re using the Drag & Drop interface, you might try resizing the image before uploading it to Cloudinary or Firebase:

If you’re using the Snap to Place interface, we really need a way to resize images there. Please consider commenting on this GitHub topic:

It’s been tagged as “planned work” for almost a year. I’m hoping it gets added soon.


Thank you for the suggestion!

You can also use mediaDB’s link and save that to firebase (I don’t think firebase supports images).


I also did that now! Thanks a lot!!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.