- Newest
- Most votes
- Most comments
I am using Lex2 and the following format to define conditions: fn.IS_SET({matricula}) = "TRUE" fn.IS_SET({poliza}) = "TRUE"
When building, I'm getting this error:
Invalid conditional expression in slot 'dni' of intent 'DarMatriculaDNI'. Invalid expression: fn.IS_SET({matricula}) = "TRUE" - Invalid conditional expression in slot 'dni' of intent 'DarMatriculaDNI'. Invalid expression: fn.IS_SET({poliza}) = "TRUE"
Both slots {matricula} and {poliza} are in the same intent as {dni}.
¿What am I doing wrong?
The error you're encountering is due to incorrect syntax in the conditional expression. When using fn.IS_SET() in Amazon Lex V2, you don't need to compare it with "TRUE" as the function already returns a boolean value.
The correct syntax should be:
fn.IS_SET({matricula})
fn.IS_SET({poliza})
According to the AWS documentation:
"The fn.IS_SET() – value is true if a slot, session attribute, or request attribute is set in the current session."
Here's an example of correct usage from the documentation:
fn.IS_SET({SlotName})
To fix your error, simply remove the = "TRUE" part from your conditions.
https://docs.aws.amazon.com/lexv2/latest/dg/paths-branching.html
it appears the issue might be due to a combination of the following factors:
The function fn.IS_SET() is used to check if a slot, session attribute, or request attribute is set in the current session and it seems to be used correctly in your conditional expression according to the official Amazon Lex documentation1.
There have been instances where such error messages hint at issues with the version of SDK/CLI on the client's end. Ensuring you are using the most recent AWS CLI version or updating/upgrading your SDK version might resolve the issue2.
It's also worth noting that Amazon Lex V2 released a change on August 17, 2022, that affected how conversations are managed with the user. Bots created before this date do not support certain features such as dialog code hook messages, setting values, configuring next steps, and adding conditions. It's possible that this change might have impacted your bot, especially if it was created before this date. (Just as a note)
Relevant content
- asked 3 months ago
- AWS OFFICIALUpdated 3 years ago
Our bot was created after August 2022 and we're configuring the intents and subsequently these conditionals inside the Lex console, so we are not using SDK/CLI. Are there other reasons why this might be failing?
the other reasons may be
Incorrect use of brackets or braces: According to the Amazon Lex documentation, you need to use {} to reference a slot value, and [] to reference a session attribute. From the error message you shared, it seems you're using [] for reservationId, which should be a slot value, not a session attribute, based on the usual naming conventions. Make sure you're using the correct brackets or braces for your reference
fn.IS_SET([reservationId]) = "TRUE" AND fn.IS_SET({CheckOutDate}) = "FALSE"