https://discord.gg/botpress logo
#🤝help
Error and weird behavior
# 🤝help
h

helpful-vr-6699

07/25/2023, 9:45 AM
Keep getting this error in my logs, Bot works fine in the studio, I've published it to test on a localhost and I get weird behaivour. As you can see from the photo it gets from first node to 2nd and than back to first. I've shared a SS of part of the work flow,
Copy code
er X [Error]: An unknown error occurred
    at Mr (/var/task/customer_code.js:8:28715)
    at Ot (/var/task/customer_code.js:8:28492)
    at w (/var/task/customer_code.js:8:67917)
    at /var/task/customer_code.js:8:64156
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 2)
    at async saveAllStates (/var/task/customer_code.js:1231:2118)
    at async saveState (/var/task/customer_code.js:1231:4665)
    at async Object.onEvent (/var/task/customer_code.js:1254:8087)
    at async handler (/var/task/customer_code.js:2556:2331) {
  isApiError: true,
  code: 500,
  description: 'An unknown error occurred',
  type: 'Unknown',
  error: undefined
}
Chat -

https://cdn.discordapp.com/attachments/1108396291060408352/1133323503102332949/image.png

Studio -

https://cdn.discordapp.com/attachments/1108396291060408352/1133323503400140830/image.png

Log -

https://cdn.discordapp.com/attachments/1108396291060408352/1133323503639203982/image.png

w

wooden-monitor-59005

07/25/2023, 10:26 AM
I’ve got the same weird behaviour
a

acceptable-kangaroo-64719

07/25/2023, 10:47 AM
hey @helpful-vr-6699 could you try modifying one of the 'yes' or 'no' intents in the library? Just add a phrase to either (doesn't matter what), wait for your bot to finish training, then re-publish and see if the error persists.
h

helpful-vr-6699

07/25/2023, 10:53 AM
@acceptable-kangaroo-64719 Can you calrify what does it mean to wait for it to finish training? I've also disabled all agents to test but didn't work
a

acceptable-kangaroo-64719

07/25/2023, 10:53 AM
The text composer in the emulator will flash a little messge like ⌛ the bot is training
it's a very short amount of time, like 2 - 5 seconds
h

helpful-vr-6699

07/25/2023, 10:54 AM
I added YES and NO to both respectively
Still the same
I am also using this to show and start the chat
Copy code
js
      window.addEventListener("load", function () {

        setTimeout(function () {
          window.botpressWebChat.sendPayload({
            type: "trigger",
            payload: {}
          });
        }, 2500); // 2.5 seconds, not too short to let it load, not to long to have a message too delayed,

        window.botpressWebChat.sendEvent({ type: "show" });
        
      });
a

acceptable-kangaroo-64719

07/25/2023, 10:57 AM
that code looks fine, I don't think it is causing the errors. Do you have an exact timestamp on one of the logs with the error?
also what is your bot id?
h

helpful-vr-6699

07/25/2023, 10:59 AM

https://cdn.discordapp.com/attachments/1133334204726382682/1133352706002665602/image.png

83d5793d-a591-43ac-a11d-2c34416a1d15
a

acceptable-kangaroo-64719

07/25/2023, 11:00 AM
thx, I'll look it up
h

helpful-vr-6699

07/25/2023, 11:01 AM
thanks
a

acceptable-kangaroo-64719

07/25/2023, 11:06 AM
okay I take that back, I think your code is causing an error due to the blank payload. Try this:
Copy code
js
      window.addEventListener("load", function () {

        setTimeout(function () {
          window.botpressWebChat.sendPayload({
            type: "trigger",
            payload: {
              text: "Fak message",
              currentUrl: window.location.href            
}
          });
        }, 2500); // 2.5 seconds, not too short to let it load, not to long to have a message too delayed,

        window.botpressWebChat.sendEvent({ type: "show" });
        
      });
h

high-address-22342

07/25/2023, 11:43 AM
If it's not a problem I want to continue this topic. Can I implement this one that is shown in your documentation or I need to have "trigger BETA" to do it?

https://cdn.discordapp.com/attachments/1133334204726382682/1133363781150457908/image.png

because when I click the button nothing happens 🤔
a

acceptable-kangaroo-64719

07/25/2023, 11:47 AM
h

high-address-22342

07/25/2023, 11:50 AM
😢😢
h

helpful-vr-6699

07/25/2023, 11:53 AM
I've removed the code completely and still get an error

https://cdn.discordapp.com/attachments/1133334204726382682/1133366294226423888/image.png

@acceptable-kangaroo-64719 Is there anything else I can do here? I tested with your code so there is payload but it keeps having issues with registering the user input
a

acceptable-kangaroo-64719

07/27/2023, 4:47 PM
take a look at https://jsfiddle.net/GordyNumberOne/pbhf3L0d/71/ for a working example
h

helpful-vr-6699

07/28/2023, 6:20 AM
@acceptable-kangaroo-64719 Thank you, before I had a look at that I've made some changes to text node and to one of the execute code nodes that is much later but I am not longer getting the error not done much really but it seems to work.

https://cdn.discordapp.com/attachments/1133334204726382682/1134369743307034665/image.png

I am not sure if you guys have realease any updates
a

acceptable-kangaroo-64719

07/28/2023, 10:50 AM
yeah we had to reboot a few pieces of infra yesterday. Are you still getting errors?
h

helpful-vr-6699

07/29/2023, 7:34 AM
No it works fine, just this
OpenBook model not trained
2 Views