Skip to content
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

Trying to render invalid AdaptiveCards blows up WebChat/Emulator #1125

Closed
stevengum opened this issue Aug 30, 2018 · 7 comments
Closed

Trying to render invalid AdaptiveCards blows up WebChat/Emulator #1125

stevengum opened this issue Aug 30, 2018 · 7 comments
Assignees
Labels
p2 Nice to have
Milestone

Comments

@stevengum
Copy link
Member

Trying to render improper AdaptiveCard attachments results in the following (using the v4 emulator, build 4.0.218-nightly):

explode

The attachment looks like this:

{
  "contentType": "application/vnd.microsoft.card.adaptive",
  "content": 5
}

This is the error from the dev tools console:

react-dom.production.min.js:151 TypeError: Cannot create property 'version' on number '5'
    at t.mountAdaptiveCards (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:1:117091)
    at t.componentDidMount (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:1:116352)
    at commitLifeCycles (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:72264)
    at x (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:60072)
    at w (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:58882)
    at g (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:58413)
    at _ (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:58250)
    at b (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:57629)
    at c (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:57091)
    at Object.enqueueSetState (file:///C:/Program%20Files%20(x86)/Bot%20Framework%20Emulator/resources/app.asar/node_modules/@bfemulator/client/public/vendors.js:43:46322)

Line of code from vendors.js:

// Line 5009:
    "../../../node_modules/botframework-webchat/built/AdaptiveCardContainer.js": function(e, t, n) {

// Line 5096
t.prototype.mountAdaptiveCards = function() {
  var e = this
  , t = this.props.nativeCard || new o.AdaptiveCard;
  t.hostConfig = this.props.hostConfig || p;
  var n = [];
  if (!this.props.nativeCard && this.props.jsonCard && (this.props.jsonCard.version = this.props.jsonCard.version || "0.5",
@compulim
Copy link
Contributor

In AdaptiveCardContainer.tsx:170, we are setting version on a number, thus, we are getting that error.

We want to make sure exceptions are caught and passed to line 228.

@corinagum can you look at it?

@compulim
Copy link
Contributor

Please verify if it repro in v4. If you need to write a bot to do the job, please use the MockBot and add a new command there. So we can easily track regressions there.

@compulim compulim added Approved p2 Nice to have labels Oct 30, 2018
@compulim compulim added this to the v4.2 milestone Oct 30, 2018
@punitganshani
Copy link

Still facing this issue with Webchat and blows out the Emulator. Any fix?

image

@corinagum
Copy link
Contributor

@punitganshani We are working on a fix and plan to have it for the next milestone. Thanks for your patience!

@sgellock sgellock added 4.3 and removed 4.2 labels Nov 27, 2018
@corinagum corinagum added 4.2 and removed 4.3 labels Nov 28, 2018
@compulim compulim modified the milestones: v4.2, v4.4 Nov 28, 2018
@corinagum
Copy link
Contributor

Merged

@compulim
Copy link
Contributor

@punitganshani I am fixing the CI/CD, it wasn't working for v3 for a while. Stay tuned, should get a build out soon.

@compulim
Copy link
Contributor

compulim commented Nov 28, 2018

@punitganshani it is in @0.15.1-v3.4da20d6. You can either do npm install botframework-webchat@legacy, or npm install [email protected] to get the fix. Please let us know if it doesn't work for you, we are happy to help.

p.s. CDN at https://cdn.botframework.com/botframework-webchat/legacy/BotChat.js, or https://cdn.botframework.com/botframework-webchat/0.15.1-v3.4da20d6/BotChat.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 Nice to have
Projects
None yet
Development

No branches or pull requests

5 participants