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 'call' of undefined

See original GitHub issue

I get this error when using the lib in the browser:

Uncaught (in promise) TypeError: Cannot read property 'call' of undefined
    at new hd (vendor.57ab6ea3.js:19)
    at new vh (vendor.57ab6ea3.js:22)
    at index.c008e8f0.js:1
hd @ vendor.57ab6ea3.js:19
vh @ vendor.57ab6ea3.js:22
(anonymous) @ index.c008e8f0.js:1
Promise.then (async)
sendMic @ index.c008e8f0.js:1
wt @ vendor.57ab6ea3.js:1
Et @ vendor.57ab6ea3.js:1
n @ vendor.57ab6ea3.js:1

the stack trace is obfuscated but the line it points to seems to be in the readable-stream module. (i think its this one? https://github.com/nodejs/readable-stream/blob/master/lib/_stream_duplex.js#L60) Code:


            navigator.mediaDevices.getUserMedia({
                audio: true,
                video: false
            }).then((stream) => {
                createPeer(this.socket as Socket);

                peer.addStream(stream);
            });
        }
function createPeer(socket: Socket) {
    if (!peer) {
        peer = new Peer({
            initiator: true
        });

        socket.on('peer-signal', (data) => {
                peer.signal(data);
        });

        peer.on('signal', data => {
            socket.emit('peer-signal', data)
        });
    }
    return peer;
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:9

github_iconTop GitHub Comments

2reactions
remaininlightcommented, Sep 23, 2022

Working for me now using:

npm install -D vite-compatible-readable-stream

Thanks @m00nwtchr for: npm install -D events

Fake process for the browser: npm install -D process global Then add this before you use SimplePeer:

import global from 'global'
import * as process from "process";
global.process = process;

Add this to your vite.config.ts:

  resolve: {
    alias: {
      "readable-stream": "vite-compatible-readable-stream"
    },
  },

Think that’s most of what I did, good luck!

1reaction
m00nwtchrcommented, Jul 5, 2021

Nvm, looks like i just had to install the events package

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'call' of undefined ...
One of the solution was to use concatenateModules: false apparently, but to no avail, it didn't solve my issue. So I tried with...
Read more >
Uncaught TypeError: Cannot read property 'call' of undefined
I'm having an issue with webpack where if I stop watching and restart, it will build just fine, but if I edit a...
Read more >
Uncaught TypeError: Cannot read property 'call' of ... - Laracasts
You need to show us your code that is causing the error. It's pointing to my vue component, I excluded it from app....
Read more >
Cannot read property 'call' of undefined" error occurs when an ...
HtmlEditor - The " __webpack_require__ => Uncaught TypeError: Cannot read property 'call' of undefined" error occurs when an application with ...
Read more >
error in console TypeError: Cannot read property 'call' of ...
TypeError : Cannot read property 'call' of undefined - the code is. the file linked to the message is a theme bundle file...
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