-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Javascript] TypeError: Cannot read property 'isValid' of undefined #4767
Comments
please review this issue for target Milestone, Inconsistencies & Priority upon triage. |
@dclaux can you help take a look at this real quick ? Thanks |
@scottlovegrove wow that is due to a I will fix, but in the meantime you can work around the problem by explicitly calling const adaptiveCard = new AdaptiveCard();
adaptiveCard.version = new Version(1, 2);
const textBlock = new TextBlock();
textBlock.text = 'Sample';
adaptiveCard.addItem(textBlock);
let withThisItWillFail = {
card: adaptiveCard
}
const serializedCard = adaptiveCard.toJSON();
let withThisItWontFail = {
card: serializedCard
}
JSON.stringify(withThisItWontFail); |
🎉 Handy links: |
Platform
What platform is your issue or question related to? (Delete other platforms).
Author or host
Author
If you're an author, who are you sending cards to?
Custom renderer, but not important for this bug
Version of SDK
2.3.0 of adaptivecards on npm
Details
If I try and return an adaptive card as part of an API response, and the adaptive card isn't the root item, I'm getting the following error:
I've managed to create a repro project with this in. Just run
npm i && npm run start
then point tohttp://localhost:4001/card
to reproduceadaptivecards-repro.zip
The key part to reproducing the problem is this:
What then happens is
card
is passed through as the context oftoJSON
which results in the above error when comparing versions.The text was updated successfully, but these errors were encountered: