Attendees – Jonathan Braganza, Glen Gabriel, Benjamin Palko
Transcript:
Here.
So it was here.
Okay, so
we had this, there were same copy and body of undefined. And if we look, the stock is coming from dashboard, JS at 98.
And that’s when we’re handling the dashboard in the metabase. service.
So what we can do is, is referencing the, the build files, which makes it
you can’t go directly to source files right away. But what you do is
come down, we find dashboard j s, we go to line 98 199, you
- Okay, well, there’s no 98.
Anyway, the problem was here.
So what was happening, if we flip over to the source code, it’s a lot easier to read.
But I just did the fix or look at the diff.
Okay, so it was down here. So the left side is what it was. Right side. So I changed it to.
So what was happening on is,
when we called Body Body, we’re getting the interface version of this dashboard. So how the dashboard works is essentially this wraps around an interface you give it up here,
you give it the dashboard interface, and it just kind of wraps around it the important files which actually has like localize for, we kind of put those there. So these are other objects which localize we kind of put them up there separate fields.
And then
when we call localized, that’s where we adjust those fields. But then we return the instance of this dashboard when you do that. So when you localize you just to dashboard localize, and then it returns that dashboard object again, so that you can call another operation on it. So you can chain the operations if you want.
So I have that set up so that you clone it.
You remap field references, and then you localize, and each of those returns the dashboard object again, so you can chain them all together. And then when you’re done, all that you call body returns an actual object of the dashboard. So what it’ll do is it goes this dashboard,
which is this thing up here
look confusing, because the class is called dashboard. And there’s an object or an attribute called dashboard as well remember,
that’s a little confusing, but
so what we end up doing is just get an instance of this. And these are the different things that we actually localize on. So then we’re just doing that here. So in localize, we’ve already adjusted all the things that need to be adjusted. And now what we’re doing is we’re just overriding the dashboard members now. So we have these localized, ordered questions, we’re not overriding
the order cards on the dashboard.
Same with parameters, and I’m down here though, as doing it are a really weird way, which I think it was kind of before
I had made this nothing up here. I had, I have this down here doing that. So So what happened here is is doing
is getting all the keys on this interface here.
So what’s happening though, is the all those keys are IDs. So if we look at the template here, so this is like, if it’s running through a template, it’ll come across this and it goes, Okay. So these are all numbers are like string numbers. And this is an ID and this ID is a reference to a field ID.
And yet it uses that field ID as its key. But when we’re localizing it, we have to change that field ID.
So then that’s what happened.
Up here, we are going to remap the field references on the brownfield
sites, what we’re doing here is we take the old ones, we use them to reference the tables and the fields in the store database,
we then get that field on the table. And then we use that to find the new ones in the active database.
And then we get the ID of that field and table and we replaced them.
So in here, what we’re doing is we’re replacing this and this with the new active IDs. But then since we’re replacing this, then this needs to change as well. So this is now different.
So it’s a different key. But the problem was that I was using the same old key to try and reference the new field filters that have been localized. But they use different keys now because they’re different IDs.
Okay, yeah. So that’s what’s happening here. So then you get this key, you won’t find anything, this is undefined, and then they will try and call body on undefined. Right?
So the solution was, you set all the prime fields, you set it to an empty object, and then you remap all the keys.
Yeah, so basically, okay. I mean, you just explained it, right. But basically,
any, any ID could change. And so we can’t assume that what the IDS in the templates would remain the same. That’s basically the gist.
Yes, okay. Yeah, make sense of that. So that’s what this bug was.
So that one it is, so I needed to get in to the debug to be able to find that. So it’s still running.
Yeah, so that would be the next one, if you don’t mind, kind of pretending you’re starting and how they can find it and test it. Right? Okay. So how I found it was, if we go back to the log, and it says, cannot read body property, a body of undefined dashboard body.
So in dashboards, right, so then this goes, Okay, so it’s obviously calling dashboard, body at dashboard body
in the dashboard file, so then that goes, Okay, well, this error is happening in the dashboard file. Okay. So you said some time ago, okay, well, it’s happened. And this says it’s happening the dashboard body method. So America, okay, so what I’ll do is I come in here I go, put a breakpoint at the start of this method, because whatever error is happening is somewhere inside this method.
And we’re calling body on different things here. I don’t know which one it is. So then,
Oh, right. And since this error is only happening on the EU, we need to test on EU. So to do that.
The normal test event has these environment variables. So there are the US East one, and US East one for metabase as well. You need to update those or create a new run config, which uses EU central one, eu central one for metabase as well. And now when you run it, it’ll run against the EU metabase and the EU Dynamo.
Okay, cool.
Yeah. Okay. Yeah. So now when we run setup, it’ll be running setup for EU.
So now that we’re here, we can go here. So now, I’m just want to double check before I run through this again.
Okay, so I also put brake on here. And also we need to know which dashboard this is happening on because it’s not happening on every dashboard. Because you saw here around you this so what we do is we look at it says handling,
dashboard, conversation analytics, it gets through all the
questions here and then it starts handling interaction summary dashboard, and then that’s when the errors come up. So we noticed the interaction summary dashboard.
So what we can actually do
is guessing here, we can make this
dashboard name equal was
In
summary, so we can actually have a conditional. I don’t know if you can do this in VS code. But here you can have a conditional breakpoint, where it’ll break only on this dashboard.
Now if we run this, we’ll go through
and hopefully it hits this.
There we go. So I hit it. So it skipped the first dashboard. It didn’t hit the breakpoint there hit the breakpoint on this one.
All right now it did hit the first one, because I haven’t.
How’s it different breakpoint ahead?
Okay, so I just ignored my breakpoint, I’m just going through so that conditional didn’t work.
And it’s just running through now because it’s not hitting the bug anymore. So it didn’t error out or anything
like that, that’s fine on which is clearer. Like, I can play with this and make sure that my environment for testing is,
is working for me. Right? Okay. So
there we go. Okay, now we hit the breakpoint. So now we can go through and come through here, this doesn’t air out, that doesn’t error arrow.
And this one won’t anymore. But if it was the old code would go through here, we’d get in here called body, and then when it hit body in the for loop, then it would have errored out.
So then we would know that
that’s what caused caused it.
I don’t know if you can do this in VS code. But you can also do
like an evaluate expression. So I can do this. So key is not defined because I’m not in the for loop right now. But if I want like this, you can evaluate different objects. So this is an empty object right now. Because
this is empty.
Right? So I guess,
I guess this was a, an empty object.
Anyway, so that’s how you can debug. Bear.
Okay, yeah, this is this is, this is great.
To to run the setup, you’re using test harness, is that what we’re doing? Yeah, yeah. So I mean, it kind of has different names. I just call it test event, because we’re sending in an event. But then if you look at the code, and the code is called test harness, that’s like,
that’s just because we inherited it from somewhere else.
Alright.
So I can only play with that definition. If you’re still here next week, make sure that I can get to, to the point where I can do what you just did. I mean, reading the code is obviously, yeah, that’s a given. But, yeah, so what why why is it that it only happen on the EU region and not on the others? Yeah, the IDS in the other regions? Is that was never me.
Yeah, what what probably is, is since
Yeah, so what it is, is, since the database that we’re storing is technically the US dev database, that when we run it on us,
it doesn’t actually change anything. When it’s like local, when it’s remapping all these field filters and stuff to different IDs is not actually changing the IDs, it runs through the process. But they’re the same IDs that it’s storing, so then doesn’t actually change anything.
But then when we run it in the other regions, they actually have different IDs now. So then when you run it, you hit these bugs. So it’s like you need to run to reveal the testers properly, you need to run it in these different regions, which we weren’t doing before. Because we only had the one region. So then these bugs wouldn’t show up. Like, I think before we had regions we had public sudden we would push the public and then all of a sudden, we
got all these bugs that we didn’t have in dev? And that’s one of the reasons
is just, yeah, I probably run set up against Dev. The database isn’t any different from what we’re storing.
Right? Okay, that makes sense.
I think you can stop recording now. I think we have. We have a debug session recorded.