Execute Code Card Started Failing Randomly
# 🤝help
l
Bot has been live for weeks without any errors and just started failing to execute code in the last 24 hours in both test and production iss_01HWX654Z9FDGXQYZAQ1N7E9MV An error occured while running Execute Code card: Cannot read properties of undefined (reading 'find') Botpress status looks green, any ideas? https://cdn.discordapp.com/attachments/1235656588258447512/1235656588526620734/image.png?ex=66352a60&is=6633d8e0&hm=cf3bf1e445c764a30be2e59d316f459ee1180c425c3d79ff76153db157b84bb2& https://cdn.discordapp.com/attachments/1235656588258447512/1235656589092982814/image.png?ex=66352a60&is=6633d8e0&hm=8471e8bd188cd8f2d96530b6f2cab878863d6f4a1b1f055e10690b0757e29ed4&
b
are you making a call to an API here?
l
nothing external -- matching NLU entities from user inputs to a list. Has been working flawlessly until earlier today and I haven't touched the code in this workflow recently.
Copy code
const SubstanceEntity = event.nlu.entities.find((entity) => entity.name === 'SubMatch')

if (SubstanceEntity) {
  workflow.SubMatch = SubstanceEntity.data.value
}
Error log from console: Execute code "Find and assign a substance entity value to a workflow." Error executing action "inline-card:Find and assign a substance entity value to a workflow..js" in flow:Reaction ID Flow:node:Standard1 No exception handler found in flow:Reaction ID Flow, going to parent Leaving workflow (flow:Reaction ID Flow) [node:Standard1] back to (flow:Main) [node:SmartID_Entry] Falling back to Workflow Error
For what it's worth, this code was generated using the Gen AI feature in the Execute Code card. I tried using the same feature to rewrite it and there is zero response.
w
@limited-lunch-44607 does
event.nlu
show
errored: true
? And if so, what
openbook_model_id
is indicated? This seems to be very similar to a problem I'm running into
l
"An error occured while running Execute Code card: Cannot read properties of undefined (reading 'find')" it fails to run the lookup on the entity list I think
checking for model ID
w
oh yeah, I see -- 404 error when calling the Openbook API // to see the model ID, you might have to console log (or bind to a variable)
event.nlu
'cause the model ID is a key in that object -- I was just curious whether the model ID in your case is the same as in mine
l
I can try to check -- have had to disable my bot until this is resolved
these Execute Code cards are critical to my flows
w
yeah I hear you 100%. -- this NLU outage has completely borked my work
l
My errors started right after my last publish, but I did not edit this code at all. Just added rows of content to a spreadsheet in a KB. model 96b67ba92419f9b5.d208c1c3dae45987 (?)
are you using the new webchat feature?
https://api.botpress.cloud/v1/cognitive/openbook/predict shows code":405,"type":"MethodNotFound","message":"not found"
w
hmm -- yeah the timing was very similar in my case, though I'm not using the webchat feature at present
l
execute code card is still not working in my test environment
clearing cache/cookies and trying again
refreshed one of my intent lists and the entity list that I initially noticed the error with and everything seems to be working again