Debugging in Thunkable X (Video)

Hi @tatiang, I thought I was calling the "getUser function while using the Debug function. I am confused now.

How do I call the getUser function?

Andos.

When I say “call” a function in Thunkable, it just means that you have the blue block getUser that runs the blocks defined by that function elsewhere. The contents of the function don’t do anything until it’s called.

I think this explains it pretty well and maybe the video would be helpful, too: Functions - Thunkable Docs

Hi @tatiang, understand “calling” now but that still doesn’t explain why the Debug function is not working.

Can you think of any other reasons why my Login screen has suddenly stopped working?

Andos.

My suggestion was to call the getUser function and see what the results of all of these Run_Debug blocks below are. Did you do that? Are you saying that none of them show up? If so, how have you confirmed that the getUser function ran at all?

image

I did run them as you suggested and it just counted 1 thru 5. That was all. See video below:

Andos.

You’re either not calling the getUser function or you are and your other debugging functions are getting in the way of seeing the results. Can you share an updated project link?

Hi @tatiang, as requested, here is the latest link to my Login blocks:

https://x.thunkable.com/copy/7c895b189355c9c36fd8761f1e9f3f83

Andos.

Is it possible for you to private message me with an email address and password I can use to sign in? If not, I’ll see if I can work around that but it would be quicker to use a valid combination.

And can you try signing in on the first screen in this modified project: Thunkable

I added a function called getUser DEBUG and I think that might help here.

Hi @tatiang, how do I “private message” ?

Andos.

To do that, you tap on the person’s profile picture, then you press the message button.

2 Likes

Thx :+1:

Andos.

It turns out I can’t run it without your Firebase API key, etc. So you’ll have to do the debugging on your end.

When I don’t know why something isn’t working, I just keep adding more and more debugging function calls like this to help me narrow down where the problem is:

Also, I wasn’t seeing the error displayed in the Status Label so I added the Run_Debug and it showed me the error (missing API key).

Anyway, hopefully you can get some idea of where the problem is by adding more debugging function calls. I would want to know if you see the debugging text in this order:

Signing in…
Error: or Not verified. or Verified. - only one of these will show up
Calling getUser…
Start getUser
num rows
index
username:
End getUser

Which of those appear/don’t appear?

Hi @tatiang, I have inserted Debug blocks you have shown above and have left the Debug blocks in situ within the getUser function. I was not sure whether to remove them or not. See below:

I then ran the Debug operation. See video below:

As you can see, I got the same counting result.

So I removed the Debug blocks from the getUser function as below:

getUser block without Debug Blocks-Screenshot 2022-12-19 13.34.08

And I still received the same result. See video below:

I can’t help wondering…could this debug issue have something to do with the way the Debug blocks are set up for this particular type of purpose? See blocks below:

What I mean is, is there another way to set the blocks up so that they display what results they find?

Also, I was wondering could problem be because I added a “j” variable?

Debug j blocks problem-Screenshot 2022-12-19 13.49.53

I have just noticed that the “j” variable isn’t actually associated to anything outside of the Debug blocks.

Andos.

Hi @tatiang,
in the Run Debug function I tried replacing the User_Values_Text’s Report variable with the list of Values in AvLogUserEmailinSheet1/ Username block from the getUser and return function block (below)

and received the results in the video below. I don’t know whether this was the correct approach so I am asking you for thoughts about this.

Andos.

No, the report variable needs to be used in the Run_Debug function. That function should look like this:

set Debug Status Label’s Text to [report]
wait 2.5 seconds

Please stop clicking the Debug button. It doesn’t do anything helpful. It just shows 1, 2, 3, 4, 5 because that’s how you’ve programmed it.

You need to focus on these:

When you sign in by clicking the LoginButton, you should immediately see either “Error: [error]” or “Not Verified” or “Verified.” Which one do you see?

Hi @tatiang, here are how my blocks are currently standing. With no Debug blocks in the getUser function. Do you wish for me to put them back in?

When I click on the Login button the results are shown in the video below:

I tried putting in 0.5 sec Control blocks into the Login blocks but still couldn’t see any “Error” messages.

So, as you had suggested, I changed the Debug Status Label’s Text to [report] timing to Wait 2.5 secs

Here is video of the results:

Also, does this screenshot of the error message help at all?

LoginErrorMsg-Screenshot 2022-12-19 19.26.01

Andos.

Yes, put the debug function calls back in the getUser function. You actually made some progress because in the videos it shows “Signing In” and “Finished Signing In”. So we know it’s gotten to those parts of the When LoginButton Click event. Now we just have to figure out why the getUser function isn’t working right. Or more importantly, I guess… why are you not seeing “Verified”. I think maybe the getUser function isn’t a problem at all because we can’t even get there. As I said, you should be seeing Error: or Not verified or Verified appear in the debug label.

But you’re also displaying all of this:

image

Which I don’t understand where that’s coming from. Maybe you added a debug call with a variable/list instead of a text string?

After you add the debug calls back into getUser, please share a link to the updated project.

Hi @tatiang, I have returned the Debug blocks back into the getUser function (See below)

And this video shows the resulting outcome:

Below, I shown a screenshot of the details shown:

Could these list blocks maybe have something to do with the problem?

Andos.

Hi @tatiang, I have just noticed something odd in my Firebase database in Thunkable, All the members’ info is showing as “Thunkable” in every cell. See below:

Is this just a security thing?

All the members in the database are showing in the Firebase website shown below:

Is this relevant?

Andos.

Yes, external data sources won’t show up if you share a project. It will just show “Thunkable” for the cells. No, that shouldn’t be a problem.

As I said, please don’t click on the Debug button any more. I would encourage you to delete all of the blocks in this screenshot:

And the link to the updated project?