[Vuejs]-Pusher Cannot read properties of undefined (reading 'push')

0👍

Update:
The connection with the Pusher is not needed if the Laravel Echo is used.
I focuesd on Echo and I’ve deleted the this block:

  let body = document.querySelector("body");
  if(body.classList.contains('gruppo-app')) {
    Pusher.logToConsole = true;
  
    var pusher = new Pusher('mykey', {
      cluster: 'myclutes'
    });
  
    let teamChannel = pusher.subscribe('team-list');
    teamChannel.bind('updated-team', function(data) {
    app.team.push(JSON.stringify(data)); 
    });
  }

To connect Echo correctly the dot . has to be added to the listen function like this:

 window.Echo.channel('team-list')
             .listen('.updated-team', (e) => {
                 console.log("echo is working");
                 console.log("e is " + e);
             })

Now the Pusher is working correctly.

Leave a comment