Connecting cloud variables to firebase

I have started a project at Firebase and I defined a cloud variable (at database tab). I have copied the apiKey and databaseURL to my app (at Firebase Settings). I don’t know why I can’t change the value of this variable from Firebase.

Is there any video shows how to setup a cloud variable at Firebase and allocate its value to a corresponding variable at thunkable cross project?

Could anybody help me with some steps to connect my app with a firebase project?

I am also wondering how to view the cloud variables initialized in the app in Firebase.

Generally speaking, it would be awesome to have some consolidated/more detailed documentation on how cloud variables work with Firebase.

The “cloud” type variables seem to be stored in the Thunkable real-timeDB, even after setting up firebase. If you want to be able to modify the data you save to cloud type variables, you can make calls to the realtimeDB and you can definitely find a tutorial on YouTube from @Darren related to this topic! I would love to know more about this as well though but this has been my workaround for now.

Maybe someone else in the community has more info on this?

1 Like

I have followed Darren’s video on the subject exactly, step-by-step, and I am not able to create or update cloud variables in firebase.

At this point in the video ( he has

  1. created a cloud variable in thunkable
  2. created a project in firebase
  3. created a realtime db in firebase
  4. set the realtime db to ‘test’ mode, so no auth is required to write to it
  5. copied the db url into the thunkable settings
  6. copied the api key into the thunkable settings

He then goes back into firebase, views his db, and it automagically has a node corresponding to the cloud variable he created. I have done all of those things, and no such node exists. I’m going effing bonkers.

edit: I am not able to use the direct realtime db component in thunkable, because my project is in the drag-and-drop editor, which apparently can’t use that.

1 Like

You can use cloud variables to refer to firebase paths. You don’t need a separate component to do this.


It helps if you can show your blocks so that other members can review and suggest course of correction.

Thanks for responding! Here are my blocks. I had written a lot that was more complicated, but have stripped it back to remove as many variables as I could. When I click the button, I don’t navigate to the other screen. If I put the navigate block above the list block, I do navigate to the other screen, but either way, nothing shows up in firebase.

Screen Shot 2021-03-16 at 10.16.49 AM

1 Like

I’m sure this is not the only coding block in your project and therefore I need to ask you two questions.

  • Is your Firebase API key and database URL supplied in the project properties?

  • You are trying to use the cloud variable as a list. However when cloud variables are first created they hold null value and to be able to use them as list you will have to first initialize them in your code with empty list. Not doing that results in the operation to fail. Have you initialized your cloud variable somewhere in your code?

1 Like

I would also make sure you can access existing data before trying to create/update new data.

You should be able to set a label’s text to a cloud variable with the full pathname to a Firebase value.

1 Like

However when cloud variables are first created they hold null value and to be able to use them as list you will have to first initialize them in your code with empty list.

That was it! I didn’t know that there’s a difference between “null” and “empty”! I’ve added a block to set the cloud variable to an empty list, and now I can write to firebase. Huge step. Thanks!

Now my problem is that my code overwrites the same list item in firebase every time. I thought I would get successive nodes, each with its own value for ‘p1d’ on every click of the button, but it’s just overwriting the “0” node.


Instead of assigning the cloud variable directly to an empty list, use a control block. Basically to say

If cloud variable is null
Initialize to empty list
End if

This way the cloud variable will not be overwritten with every round.

Happy Thunking!

1 Like

oh, duh, it’s deleting every time because I’m telling it to, by setting it to an empty list.


1 Like

Hmm, I’m able to write to the DB now, but I can’t get that data back out with a query. I don’t want to take over this thread with a separate issue, but I did create another question (with screenshots, etc.) over here. Would really appreciate your thoughts:

1 Like