question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'role' of undefined

See original GitHub issue

I used chatdown v1.0.9-20 to convert a very simple .chat file into a .transcript file.

I got the following error when I open the .transcript file in Bot Framework Emulator (4.0.0-preview.40025) Error creating a new conversation in transcript mode: Error: Error while feeding transcript on disk to conversation: Cannot read property ‘role’ of undefined

I don’t know if it’s related to chatdown or Bot Framework Emulator.

image

Here the .chat file:

user=vishwac
bot=cafebot

user: hi
bot: Hello, I'm the contoso cafe bot. How can I help you?

Here the .transcript file generated by chatdown:

[
  {
    "conversation": {
      "id": "zH4ddZX/tW5AO1SKWmRinDick9M="
    },
    "id": "1",
    "timestamp": "2018-09-27T02:20:18.100Z",
    "type": "conversationUpdate",
    "channelId": "chatdown",
    "membersAdded": [
      {
        "id": "jopVZjYqyE3A5EnA8dYrlA+Mubw=",
        "name": "cafebot",
        "role": "bot"
      }
    ],
    "membersRemoved": []
  },
  {
    "conversation": {
      "id": "zH4ddZX/tW5AO1SKWmRinDick9M="
    },
    "id": "2",
    "recipient": {
      "id": "jopVZjYqyE3A5EnA8dYrlA+Mubw=",
      "name": "cafebot",
      "role": "bot"
    },
    "from": {
      "id": "aqMkJoc/DqiL+cgiJhoUJCxSZ+U=",
      "name": "vishwac",
      "role": "user"
    },
    "text": "hi",
    "timestamp": "2018-09-27T02:20:20.100Z",
    "type": "message",
    "channelId": "chatdown"
  },
  {
    "conversation": {
      "id": "zH4ddZX/tW5AO1SKWmRinDick9M="
    },
    "id": "3",
    "recipient": {
      "id": "aqMkJoc/DqiL+cgiJhoUJCxSZ+U=",
      "name": "vishwac",
      "role": "user"
    },
    "from": {
      "id": "jopVZjYqyE3A5EnA8dYrlA+Mubw=",
      "name": "cafebot",
      "role": "bot"
    },
    "text": "Hello, I'm the contoso cafe bot. How can I help you?",
    "timestamp": "2018-09-27T02:20:22.100Z",
    "type": "message",
    "channelId": "chatdown"
  }
]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
justinwilabycommented, Sep 27, 2018

This is a known issue with chatdown. Updating to 1.0.10 fixes this problem. As a workaround, the emulator uses this version under the hood and can convert .chat files into transcripts and feed them into the chat window automatically. To do this:

  1. open a bot file in the emulator
  2. click on the resources icon image
  3. Click on the cogwheel to open the settings dialog and browse to the location of the directory that your chat files are in. image
  4. Click “Save Changes”
  5. you should now see your chat files in the scripts pane. Clicking on the chat will convert it to a transcript and display it in the chat window image
0reactions
tonyanzianocommented, Oct 9, 2019

@paulfitz72 I was unable to reproduce this with botframework-cli@4.5.4 and both version 4.5.2 of the Emulator, and the newest nightly build.

test.chat

user=Tony
bot=MrBot

user: Hey bot!
bot: Hello Tony!

generated test.transcript

[
  {
    "conversation": {
      "id": "8g3mrSOCs+ReSF5moEvcCuHIXFA="
    },
    "id": "1",
    "recipient": {
      "id": "s1KG+2yGBuF6atkrwxuBbNQFj7g=",
      "name": "MrBot",
      "role": "bot"
    },
    "from": {
      "id": "yPqMtPiPeEhc5+BFOsDUOAJrxbs=",
      "name": "Tony",
      "role": "user"
    },
    "timestamp": "2019-10-09T22:26:47.100Z",
    "type": "conversationUpdate",
    "channelId": "chatdown",
    "membersAdded": [
      {
        "id": "s1KG+2yGBuF6atkrwxuBbNQFj7g=",
        "name": "MrBot",
        "role": "bot"
      }
    ],
    "membersRemoved": []
  },
  {
    "conversation": {
      "id": "8g3mrSOCs+ReSF5moEvcCuHIXFA="
    },
    "id": "2",
    "recipient": {
      "id": "s1KG+2yGBuF6atkrwxuBbNQFj7g=",
      "name": "MrBot",
      "role": "bot"
    },
    "from": {
      "id": "yPqMtPiPeEhc5+BFOsDUOAJrxbs=",
      "name": "Tony",
      "role": "user"
    },
    "text": "Hey bot!",
    "timestamp": "2019-10-09T22:26:49.100Z",
    "type": "message",
    "channelId": "chatdown"
  },
  {
    "conversation": {
      "id": "8g3mrSOCs+ReSF5moEvcCuHIXFA="
    },
    "id": "3",
    "recipient": {
      "id": "yPqMtPiPeEhc5+BFOsDUOAJrxbs=",
      "name": "Tony",
      "role": "user"
    },
    "from": {
      "id": "s1KG+2yGBuF6atkrwxuBbNQFj7g=",
      "name": "MrBot",
      "role": "bot"
    },
    "text": "Hello Tony!",
    "timestamp": "2019-10-09T22:26:51.100Z",
    "type": "message",
    "channelId": "chatdown"
  }
]

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >
[Solved] Cannot read Properties of Undefined in JavaScript
The 'Cannot read properties of undefined' error occurs when you try to access a property or a method on a variable that stores...
Read more >
Cannot read property 'roles' of undefined | discord.js | javascript
It seems as if your usera variable is storing a User object, which doesn't have the property members . It looks like you're...
Read more >
Uncaught TypeError : Cannot read properties of undefined
Causes for TypeError: Cannot Read Property of Undefined. The error clearly says that it is Undefined, which means the variable might be declared ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found