matrix-hacks / matrix-puppet-skype

23 stars 12 forks source link

TypeError: Cannot read property 'id' of undefined #25

Closed hooger closed 5 years ago

hooger commented 5 years ago

After some hacking around I was able to compile/install the bridge and now matrix actually created the "Skype Protocol" room. So far so good! However when I send a message I get the following error:

Error in handleThirdPartyRoomMessage { TypeError: Cannot read property 'id' of undefined
    at contact.contacts.find (/usr/local/src/matrix-puppet-skype/client.js:107:19)
    at Array.find ()
    at Client.getContact (/usr/local/src/matrix-puppet-skype/client.js:106:33)
    at App.getThirdPartyRoomDataById (/usr/local/src/matrix-puppet-skype/index.js:134:31)
    at App.getOrCreateMatrixRoomFromThirdPartyRoomId (/usr/local/src/matrix-puppet-skype/node_modules/matrix-puppet-bridge/src/base.js:545:45)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
  [stack]:
   "TypeError: Cannot read property 'id' of undefined\n    at contact.contacts.find (/usr/local/src/matrix-puppet-skype/client.js:107:19)\n    at Array.find ()\n    at Client.getContact (/usr/local/src/matrix-puppet-skype/client.js:106:33)\n    at App.getThirdPartyRoomDataById (/usr/local/src/matrix-puppet-skype/index.js:134:31)\n    at App.getOrCreateMatrixRoomFromThirdPartyRoomId (/usr/local/src/matrix-puppet-skype/node_modules/matrix-puppet-bridge/src/base.js:545:45)\n    at processTicksAndRejections (internal/process/task_queues.js:86:5)",
  [message]: "Cannot read property 'id' of undefined" } { roomId: 'ODpsaXZlOmNzZXJ0ZWd0',
  senderId: undefined,
  text: '2' } 

My setup is not the default. Here are my changes:

Do you have any idea what could be the problem? Thank you in advance!

hooger commented 5 years ago

Reply arrived from chat partner. The error seems to be the same. Is it possible that there was a breaking change in the upstream puppet-bridge interface?

{ poll: An error happened while processing the polled messages
  caused by TypeError: Cannot read property 'id' of undefined
    at contact.contacts.find (/usr/local/src/matrix-puppet-skype/client.js:107:19)
    at Array.find ()
    at Client.getContact (/usr/local/src/matrix-puppet-skype/client.js:106:33)
    at App.getThirdPartyUserDataById_noPromise (/usr/local/src/matrix-puppet-skype/index.js:82:31)
    at App.getPayload (/usr/local/src/matrix-puppet-skype/index.js:103:35)
    at App.handleSkypeMessage (/usr/local/src/matrix-puppet-skype/index.js:109:24)
    at Client.client.on (/usr/local/src/matrix-puppet-skype/index.js:44:12)
    at Client.emit (events.js:193:13)
    at Api.api.on (/usr/local/src/matrix-puppet-skype/client.js:53:22)
    at Api.emit (events.js:193:13)
    at Api.handlePollingEvent (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:95:14)
    at MessagesPoller.Api.messagesPoller.on (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:30:62)
    at MessagesPoller.emit (events.js:193:13)
    at MessagesPoller.getMessages (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/polling/messages-poller.js:308:30)
    at processTicksAndRejections (internal/process/task_queues.js:86:5)
  name: 'poll',
  [_message]: 'An error happened while processing the polled messages',
  data: {},
  cause:
   { TypeError: Cannot read property 'id' of undefined
       at contact.contacts.find (/usr/local/src/matrix-puppet-skype/client.js:107:19)
       at Array.find ()
       at Client.getContact (/usr/local/src/matrix-puppet-skype/client.js:106:33)
       at App.getThirdPartyUserDataById_noPromise (/usr/local/src/matrix-puppet-skype/index.js:82:31)
       at App.getPayload (/usr/local/src/matrix-puppet-skype/index.js:103:35)
       at App.handleSkypeMessage (/usr/local/src/matrix-puppet-skype/index.js:109:24)
       at Client.client.on (/usr/local/src/matrix-puppet-skype/index.js:44:12)
       at Client.emit (events.js:193:13)
       at Api.api.on (/usr/local/src/matrix-puppet-skype/client.js:53:22)
       at Api.emit (events.js:193:13)
       at Api.handlePollingEvent (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:95:14)
       at MessagesPoller.Api.messagesPoller.on (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:30:62)
       at MessagesPoller.emit (events.js:193:13)
       at MessagesPoller.getMessages (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/polling/messages-poller.js:308:30)
       at processTicksAndRejections (internal/process/task_queues.js:86:5)
     [stack]:
      "TypeError: Cannot read property 'id' of undefined\n    at contact.contacts.find (/usr/local/src/matrix-puppet-skype/client.js:107:19)\n    at Array.find ()\n    at Client.getContact (/usr/local/src/matrix-puppet-skype/client.js:106:33)\n    at App.getThirdPartyUserDataById_noPromise (/usr/local/src/matrix-puppet-skype/index.js:82:31)\n    at App.getPayload (/usr/local/src/matrix-puppet-skype/index.js:103:35)\n    at App.handleSkypeMessage (/usr/local/src/matrix-puppet-skype/index.js:109:24)\n    at Client.client.on (/usr/local/src/matrix-puppet-skype/index.js:44:12)\n    at Client.emit (events.js:193:13)\n    at Api.api.on (/usr/local/src/matrix-puppet-skype/client.js:53:22)\n    at Api.emit (events.js:193:13)\n    at Api.handlePollingEvent (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:95:14)\n    at MessagesPoller.Api.messagesPoller.on (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:30:62)\n    at MessagesPoller.emit (events.js:193:13)\n    at MessagesPoller.getMessages (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/polling/messages-poller.js:308:30)\n    at processTicksAndRejections (internal/process/task_queues.js:86:5)",
     [message]: "Cannot read property 'id' of undefined" },
  [_stack]:
   "poll: An error happened while processing the polled messages\n  caused by TypeError: Cannot read property 'id' of undefined\n    at contact.contacts.find (/usr/local/src/matrix-puppet-skype/client.js:107:19)\n    at Array.find ()\n    at Client.getContact (/usr/local/src/matrix-puppet-skype/client.js:106:33)\n    at App.getThirdPartyUserDataById_noPromise (/usr/local/src/matrix-puppet-skype/index.js:82:31)\n    at App.getPayload (/usr/local/src/matrix-puppet-skype/index.js:103:35)\n    at App.handleSkypeMessage (/usr/local/src/matrix-puppet-skype/index.js:109:24)\n    at Client.client.on (/usr/local/src/matrix-puppet-skype/index.js:44:12)\n    at Client.emit (events.js:193:13)\n    at Api.api.on (/usr/local/src/matrix-puppet-skype/client.js:53:22)\n    at Api.emit (events.js:193:13)\n    at Api.handlePollingEvent (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:95:14)\n    at MessagesPoller.Api.messagesPoller.on (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:30:62)\n    at MessagesPoller.emit (events.js:193:13)\n    at MessagesPoller.getMessages (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/polling/messages-poller.js:308:30)\n    at processTicksAndRejections (internal/process/task_queues.js:86:5)",
  [_stackContainer]: undefined,
  message: 'An error happened while processing the polled messages',
  [stack]:
   "poll: An error happened while processing the polled messages\n  caused by TypeError: Cannot read property 'id' of undefined\n    at contact.contacts.find (/usr/local/src/matrix-puppet-skype/client.js:107:19)\n    at Array.find ()\n    at Client.getContact (/usr/local/src/matrix-puppet-skype/client.js:106:33)\n    at App.getThirdPartyUserDataById_noPromise (/usr/local/src/matrix-puppet-skype/index.js:82:31)\n    at App.getPayload (/usr/local/src/matrix-puppet-skype/index.js:103:35)\n    at App.handleSkypeMessage (/usr/local/src/matrix-puppet-skype/index.js:109:24)\n    at Client.client.on (/usr/local/src/matrix-puppet-skype/index.js:44:12)\n    at Client.emit (events.js:193:13)\n    at Api.api.on (/usr/local/src/matrix-puppet-skype/client.js:53:22)\n    at Api.emit (events.js:193:13)\n    at Api.handlePollingEvent (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:95:14)\n    at MessagesPoller.Api.messagesPoller.on (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/api.js:30:62)\n    at MessagesPoller.emit (events.js:193:13)\n    at MessagesPoller.getMessages (/usr/local/src/matrix-puppet-skype/node_modules/skype-http/polling/messages-poller.js:308:30)\n    at processTicksAndRejections (internal/process/task_queues.js:86:5)" } 
nr23730 commented 5 years ago

The keys for attributes of contacts was changed a little bit. #26 solves this.