[Bug]Error in AdaptiveCards Templating SDK: Cannot Read Properties of Undefined ('Expression')
Target Platforms
Other
SDK Version
2.3.1
Application Name
adaptivecards-templating
Problem Description
I encountered an issue where properties in the JavaScript version of the AdaptiveCards Templating SDK are undefined. How can I resolve this issue?issue-adaptive-cards-sdk.docx
Screenshots
Card JSON
// Define the Adaptive Card template
const cardTemplate = {"type":"AdaptiveCard","version":"1.0",
"body":[
{"type":"TextBlock","text":"Hello ${name}!"},
{"type":"TextBlock","text":"=if(age >= 18, 'You are an adult.', 'You are a minor.')"}]};
// Define dynamic data (this could come from an API or user input)
const dynamicData = {"$root":{"name":"John","age":25}};
Sample Code Language
JS
Sample Code
Adaptive Card with Dynamic Expression
@xiaolufei - Thank you for bringing this issue to our attention. Can you confirm whether you plan to display this adaptive card on the Teams platform?
@Nivedipa-MSFT Yes, I plan to display this adaptive card on the Teams platform.
@xiaolufei - Thanks for the confirmation. We were able to reproduce the issue.
We have logged this as a bug, and our engineering team will look into it.
While we cannot guarantee a fix at this stage, we will keep you updated with any progress or changes. Please note that in some cases, the bug may be by design or deprioritized due to platform updates, but we will continue to monitor the bug closely.
Thank you again for your cooperation!
@Nivedipa-MSFT I hope you can resolve this issue as soon as possible. Currently, this problem is blocking our work and causing our card data to fail to render.
@Nivedipa-MSFT we are also getting same error and couldn't find any adaptive-expression CDN path. Tried with below but still same error
](https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js%22%3E%3C/script%3E)
@Nivedipa-MSFT any updates on this?
I was having a similar error to the error above and so I tried to see if I can replicate above error. I was able to replicate the above error, whether or not I have the TextBlock with the dynamic expression in it.
I belive the error is related to the following.
In version 2.0 and later of adaptivecards-templating the adaptive-expressions package is not included. So when someone follows the docs and uses the script from CDN (version 2.0 or greater), it does not include adaptive-expressions and will always fail. If I changed that to use a version prior to 2.0 then the templating works, the card displays and I don't get the error. However, it still doesn't render the dynamic expression correctly. It displays the whole dynamic expression as text, rather than 'resolving' it.
Hopefully this helps shed some light on the issue
Any progress on this one? I have the same problem.
Any updates ?