Broken / missing object variable data in BotPress Studio?

Hi botpress Community,

I have an object that I am using to represent my database. I have this created within BotPress to keep things simple for. It looks something like this:

> {
> “datadb”: {
> “clients”: [
> {
> “id”: “888-27637”
> “name”: “Jim Jones”
> },
> {
> “id”: “…”
> …
> },
> {
> “id”: “…”
> …
> }
> ]
> }
> }

The interface saves the data initially, as shown here - I see “1” item reflected, which is the array of objects called “clients”, as expected:

When I click out and inspect another item in the Studio and then click back to look at the variable object, the data is gone - see the “0 items” indication and the JSON error which wasn’t there before:

This was working fine earlier in the day but now seems broken. Initially, I thought this may have been an issue with the size of the object, but even with a very simple object like the one below, I see the same situation:

> {
> “test1”: “”,
> “test2”: “”
> }

Has anyone else experienced this?

Hi @consulting ,

Did you try adding execute code card at the beginning of the flow, and in that execute code card, you can pass that information into the object?

Hi @bassam.tantawi, I meant to follow up on this and got tied up, so thanks for the reminder.

TL;DR Yes, I tried your suggestion and that did work.

Detailed update in case someone else encounters this
So as I indicated on the day I logged this, the issue I faced was that when I loaded the object JSON into my variable “datadb”, the BotpressStudio interface would accept the input and show me the nicely formatted & colour-coded representation of my input for datadb. Earlier in the day, the save went fine and utilising datadb was not a problem, this was the same for the other 2 object variables that I added.

At some point during the day, for some unknown reason, the validation activities that relied on the object started to fail and it took me a while (at least 3hrs frustrating) to figure out that the issue wasn’t the ChatGPT-generated code or my own manually written variants of the validation code, but the fact that the objects existed, but were in fact blank i.e. datadb = {} - when I went back in to look at the variables they were errors reflecting errors similar to this one, even for very simple objects, which saved correctly before … this screenshot is taken from a different bot exhibiting the same issue right now, which is a bit concerning.

Saved and accepted object
I am considered a new user, so the post won’t let me add the other image to this post :man_shrugging:t6:

Broken object

Resolution
I have no idea what changed and resulted in this breaking. Equally, I have no idea what changed for this to start working again between me realising I was not the issue, logging the support ticket and the pivoting to setting up a JSON server to query for the data instead. The fact this is continuing to occur suggests this issue needs attention as it will create major issues in PROD scenarios.

Your suggested workaround of adding an execute code card at the start of the flow did work, but may not always be practical and really this should just work. Please find and eliminate this bug.

1 Like

The saved and accepted image