Skip to content

cannot read property 'replace' of undefined #146

@ghost

Description

I'm not entirely certain if this is a bug in create-torrent, webtorrent-hybrid, or some other module, but when I run this command which works for a much smaller test directory I get a crash:

peermaps@vmi595217:~/data/peermaps/edb$ time webtorrent-hybrid create . -o $HOME/data/peermaps.torrent

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 3.5.4, webtorrent 1.5.6, node v14.17.0, linux x64, exit 1
/home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/create-torrent/get-files.js:52
      file.path = file.path.replace(path, '').split(corePath.sep)
                            ^

TypeError: Cannot read property 'replace' of undefined
    at /home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/create-torrent/get-files.js:52:29
    at Array.forEach (<anonymous>)
    at /home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/create-torrent/get-files.js:50:11
    at end (/home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/run-parallel/index.js:21:15)
    at done (/home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/run-parallel/index.js:25:10)
    at each (/home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/run-parallel/index.js:31:7)
    at /home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/run-parallel/index.js:46:37
    at end (/home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/run-parallel/index.js:21:15)
    at done (/home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/run-parallel/index.js:25:10)
    at each (/home/peermaps/.nvm/versions/node/v14.17.0/lib/node_modules/webtorrent-hybrid/node_modules/run-parallel/index.js:31:7)

real    1m36.296s
user    1m52.893s
sys     1m52.498s

It might be relevant that this directory has 2.6 million files and 99GB of data.

To reproduce, the data is also seeded to /ipfs/QmVCYUK51Miz4jEjJxCq3bA6dfq5FXD6s2EYp6LjHQhGmh

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions