webtorrent / webtorrent/webtorrent-cli

TypeError: Cannot use 'in' operator to search for 'result' in undefined

Open
#200 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
JavaScript
Stars
1.4k
Forks
153
PR merge metrics
No merged PRs in 30d

Description

What version of this package are you using?

webtorrent-cli 4.0.0, webtorrent 1.5.6

What operating system, Node.js, and npm version?

ArchLinux, node v17.0.1, npm v8.1.0

What happened?

Started a movie using webtorrent --xbmc "MAGNETLINK", the movie starts on the media player (It's a RPi running Kodi) but after one or two minutes webtorrent crashes with the following error message :

UNEXPECTED ERROR: If this is a bug in WebTorrent, report it!
OPEN AN ISSUE: https://github.com/webtorrent/webtorrent-cli/issues

DEBUG INFO: webtorrent-cli 4.0.0, webtorrent 1.5.6, node v17.0.1, linux x64, exit 1
/home/user/.nvm/versions/node/v17.0.1/lib/node_modules/webtorrent-cli/node_modules/nodebmc/device.js:41
            if( !('result' in result) && result.result !== 'ok' ) {
                           ^

TypeError: Cannot use 'in' operator to search for 'result' in undefined
    at IncomingMessage.<anonymous> (/home/user/.nvm/versions/node/v17.0.1/lib/node_modules/webtorrent-cli/node_modules/nodebmc/device.js:41:28)
    at IncomingMessage.emit (node:events:402:35)
    at endReadableNT (node:internal/streams/readable:1340:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Node.js v17.0.1

What did you expect to happen?

Webtorrent not to crash

Are you willing to submit a pull request to fix this bug?

I don't know JS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The stack trace points to nodebmc/device.js:41 in the installed dependency; start by reproducing the --xbmc run and inspect the response reaching that handler. Determine how the undefined response should be handled, then verify that the same playback scenario no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.