Debugging in Thunkable X (Video)

I thought I’d share a process I use for debugging my projects. It involves creating a function that can be used over and over throughout the code blocks in order to help determine where things are going wrong, whether or not certain blocks are ever triggering, and what the values of several variables are.

Here’s a screenshot of what I’ve set up:

The real power comes from being able to quickly change the delay (and even set it to 0 seconds) or just remove the contents of the function so that it doesn’t run at all when you’re ready to publish. I cover all of that in the video.

If you want to try out the project yourself: Thunkable

And a video that shows how to do this and explains why I do it this way:

14 Likes
Does anyone have any tips how I can "debug" my app?
How create debugging code?
How to solve crashing screen?
App freezes on thunkable loading screen
[Solved] Data viewer crashes app when refreshed [Aug 2022]
Critical error occured when trying to login in my thunkable app on other devices
Problem with insert in a spreedsheet
App Sign-in has stopped working
Creating dynamic text color changes
Issues on block...can't run the apps
Any code examples with new Firebase authentication Blocks available?
Critical Error - can't find problem
Repeat block does not work
Search bar with Data in listviewer (Google Sheet)
Problem in thunkable live of blocks
Microphone permission request leads to Thunkable live app crash
Thunkable Live app crashing
Read Objects in Column A and Pulling Values in Column B
Mobile live testing not working
Blocks in Thunkable
What is wrong for creating to Google Spreedsheet
Not able to access data from Google Sheet in app
Why is my app log in/sign up not working?
(Solved) How can i turn these functions into list blocks?
Need Help Arranging Google Sheets Data From A Web API Into Local Table
How to add quantity without create new row on spreadsheet
Sending value to another screen
I need help about cloud variables
How can i pass information between projects
Cloning container crashesh in live and published app
Screen crashes app in live preview but loads just fine in web preview
Get object from json
Character Creation
Personal Web Api to get Decibels from an audio
Upload file in airtable
Help needed with Objects and Lists
Open Ai source ChatGPT API undefined response
Sprite moving stage
Location sensor for tracking distance
Search on Google Maps
Survey Calculator
List Viewer (Simple List) calling a Data Viewer List
How can i find the component lists in the design tab for Firebase?
Hi, I am doing a app that can log in and log out app will some other useful datas but I can't connect the account with those datas so the data cannot be safed. Pls help
I want to use thunkable to make an app for warranty inspection with offline functions
Error Help me Pls (ESP)
Iterate through two google sheets columns at once?
How do I get a row id from a row object and get other information on the same row with that row id?
Blank Images when I click next
Why does this happen, is it a bug or an issue in my blocks?
How do I get started on building a 'bank transaction' type page for my app?
Searching data lists
Need a freelancer for helping me finish my code
Simple variable interation
I need help with my check box
How to change a thing in one screen and make it update in all its instances
Can I make progress save on thunkable between screens?
Can I make progress save on thunkable between screens?
Google sheets data source undefined
ElevenLabs TTS Posting, Web API
[SOLVED] Login with GetAllRows Airtable Not Working
ElevenLabs TTS Posting, Web API
How to create nested tables in thunkable
Cloud variable to retrieve user data
[SOLVED] There is an App Variable listed that I cannot find the Initialization for
My Thunkable Labels Are Showing Null Values
Help me in api set up
Help to make a drop down list
[Solved] How do I make an image appear when clicking an image from a data viewer grid?
Summing two data in google sheets
Need little help on my app logic
[SOLVED] I want to make a login system with the air table, but I have a problem
Need Help Arranging Google Sheets Data From A Web API Into Local Table
How to Implement AI-Powered Suggestions with OpenAI (ChatGPT) in Thunkable?
How can I add a loop in my math calculator
Trying to store image as a list
No puedo hacer que mi boton siga, encuentro que es un error pero no puedo arreglarlo
How to remove punctuations from user's answer
Why is my code not working?
How do i assign a result as "x" and use it in an equation?
Math blocks returning NaN/0
School student schedule
Food Rating & Photo Submission App
Automatic sign in
[Solved] Thunkable crash? The app was working perfectly(Login)
[Solved] How to trace execution in Thunkable
Who could advise me on how apply this code-logic in the BLOCKS section of Thunkable
Converting json response to Objects
Calling "Video Recorder" component's "Start Recording" method getting "Something has gone wrong. Check your blocks and reset this page" error
Help with matching pairs app
Push notifications when button click
Questions about Airtable & bardcode scanner
Location Sensor Issues
I need help making my compass app
I need help making a census app and pet tracker
My project is not woking, it crashes
How to create nutrition app with ocr scanner?
Debugging Crashes in live view
Screen shows 1 sec and then becomes blank
Cannot get color chat to work
Sign in with firebase
Can you help me with and Android build issue? “Keeps stopping”
How can I use the switch component to dynamically display different data
[Solved] Why can’t I save and retrieve data from Firebase?
How to asign properties to objects correctly
Something has gone wrong. Check your blocks and reset this page
How to prevent White Screen of Death in thunkable app?

Thank you for sharing your thoughts. Very useful :clap:t2:

2 Likes

I found the issue, When I add the dvl or dvg and select the data source, it crashes, When I removed the data source it works. But i need that dvl. What to do?

This is a topic related to debugging in general. It’s not really for specific questions about problems you’ve found in your code.

I recommend starting a new topic and including as many details (e.g. screenshots, link to your project) as possible.

2 Likes

I’m sorry, I wasn’t aware of that. I’ll do it

Hi @tatiang, using the video you sent to me, I created the Debug blocks (See below)

Debug blocks

I then tried to get them to work to find my issues by adding a User_Values_Label to the Debug blocks. The plan was to find if my Login Page was searching for my Username during the Login process.

See video for what happened:

Andos

Okay so it runs through the loop and completes the set of blocks in when Debug Click and successfully displays 1, 2, 3, 4, 5, end. Did that answer your question?

Hi @tatiang, I’m afraid it doesn’t answer my question because as my Login Screen loads, it stops at the loading icon. This suggests to me that it, either, for some reason has stopped finding the Firebase Sheet with Member details or it somehow has stopped verifying the sheet details. In which case, how can this Debug operation run through my Firebase sheet and not find anything wrong? Or, is the Debug operation not checking the Firebase Members sheet? I really don’t understand what it is that I am doing.

Are my blocks correctly set up to check my Firebase sheet? If not, how do I do this?

Please see my blocks below:

Andos.

The when Debug Click set of blocks doesn’t have anything to do with your Firebase data, as far as I can tell.

Now that you have a Run_Debug function, add it to the SignIn block because that’s where you want to see what’s happening. So inside of SignIn, add the function a few times to see where it works (displays the message) and where it doesn’t.

Edit: actually, now that I look more closely, you’re not using any Firebase blocks except the SignIn. So I’m not sure how much good that type of debugging is going to do. But I’d still try it!

More importantly, you need to debug the getUser function as I think I mentioned earlier. That’s where I’d focus my time. Check that the list of values blocks are returning the values you expect them to. Don’t rely on those blocks without double-checking.

Hi @tatiang, I apologise for sounding stupid but, how do I fit the Run_Debug function into the getUser block so it works.

Have I inserted the Run_Debug function correctly? See below:

I am still only receiving the result in the video below:

Andos

Hi @tatiang, I have a few questions…

  1. If the Run_Debug function counts 1 thru 5, does that mean there are no errors?

  2. What should I be seeing?

  3. My members’ list is not being displayed in the countdown. Is there a way to make this happen?

  4. With no Members’ List contents being shown, does that imply that the Members’ List
    is not being read?

I am guessing by “messages” you mean the “Starting”, “Running”, “Complete” and “End” messages, or should I receive some sort of other message?

  1. What are the numbers 1 thru 5 actually counting and what is their purpose? Are they counting rows in the “Firebase” spreadsheet?

Once again, I apologise for what may seem to be “stupid” questions but I somehow am not qrasping what the Run_Debug function is trying to do exactly.

Andos.

Andos.

I think you misunderstood the purpose of the debugging function. It doesn’t tell you anything by itself. All it does is display a value and then wait so you can read that value on the screen.

It’s no different than using these blocks:
Set label’s text to “1”
Wait 1 second

But I got tired of adding and configuring those blocks over and over again so I made a function to save me time.

So why use them? Well, what I usually do is to space the debug function throughout any blocks that don’t seem to be working. Like this

When [event]
Debug “1”
[Some blocks]
Debug “2”
[some blocks]
Debug “3”

That way, when I preview my project, if I only see “1”… “2” then I know the code stopped working between where I have debug “2” and where I have debug “3”. Then I can add more debugging functions between those to further narrow down what is causing the problem.

But it’s possible that all of the blocks run and I see “1”… “2”… “3”. Then what? Well, in your case you might set the debug function to display the value of each of your variables in the getUser function. That way you can see if their values are what you expect them to be. Or you might display the number of rows in your data source. Maybe you think it’s 25 but it’s really 600 or 10. That happened to me recently.

So the debug function can help to show you values while your project is running rather than only at the end. It helps to slow things down so you can figure out where something went wrong.

If it still doesn’t make sense, share a new project link and I can provide a screenshot of your blocks with debugging blocks added.

Hi @tatiang, I sort of understand a little better but I still don’t really know where I should put these blocks or how they would fit. Below, I have attached a project link, as requested, for you to look at.

https://x.thunkable.com/copy/30abe8cafdbf40b76b5f4a6403210b90

Andos.

Here’s how I would set up the blocks. The basic idea is that each time you set a variable value, you then display that variable. And I would probably increase the wait time in the Run_Debug function to 1 or 2 seconds so you have enough time to see the values that appear.

Hi @tatiang, I shall try this and let you know how I get on.

Andos.

Hi @tatiang, I set up the blocks as you suggested. (see below).

Blocks for debugging get_user function:

The Live Test result link is shown below:

Does this mean there are no errors in my "getUser function?

Or, have done something wrong?

Andos.

Hi @tatiang, I’ve just spotted and error I made please ignore previous results image and video. The amended image and video are below:

Blocks image

Live Test result video

Andos.

I don’t understand the video. It’s looping through numbers 1-5 which I suggested is not that helpful. Where are the debugging values inside of the getUser function (“index”, “username”, etc.)?

Hi @tatiang, I have placed the Run_Debug blocks within the getUser as you suggested (see blocks)

but it just counts thru with numbers.

Has this anything to do with my Debug Click blocks below?

I can’t help thinking that the Debug function isn’t picking up/ reading anything.

Andos.

Clicking the Debug button is just going to show 1, 2, 3, 4, 5 again.

For the debugging to work properly, you have to call the getUser function. That happens here: